From 1c7caa38843f011be48d92f13a58c4d87a8c2423 Mon Sep 17 00:00:00 2001 From: Collin Kidder Date: Wed, 30 Sep 2020 21:55:39 -0400 Subject: [PATCH] Fix some errors created during last merge. --- dbc/dbc_classes.cpp | 3 ++- framefileio.cpp | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/dbc/dbc_classes.cpp b/dbc/dbc_classes.cpp index 9dab43a..fb67985 100644 --- a/dbc/dbc_classes.cpp +++ b/dbc/dbc_classes.cpp @@ -1,6 +1,7 @@ #include "dbc_classes.h" #include "dbchandler.h" #include "utility.h" +#include DBC_MESSAGE::DBC_MESSAGE() { @@ -73,7 +74,7 @@ bool DBC_SIGNAL::processAsText(const CANFrame &frame, QString &outString, bool o endResult = ((double)result * factor) + bias; result = (int64_t)endResult; // if factor is an integer, we don't need the possibly human-unreadable float representation - isInteger = (factor == ceilf(factor)); + isInteger = (factor == qFloor(factor)); } else if (valType == SP_FLOAT) { diff --git a/framefileio.cpp b/framefileio.cpp index daf95c0..acb50dc 100644 --- a/framefileio.cpp +++ b/framefileio.cpp @@ -790,22 +790,23 @@ bool FrameFileIO::loadCARBUSAnalyzerFile(QString filename, QVector* fr if (tokens.length() > 3) { QString time = tokens[0].replace(",","."); - - thisFrame.timestamp = static_cast(time.toDouble() * 1000); - thisFrame.ID = static_cast(tokens[3].toInt(nullptr, 16)); - thisFrame.extended = (thisFrame.ID > 0x7FF); + thisFrame.setTimeStamp(static_cast(time.toDouble() * 1000)); + thisFrame.setFrameId(static_cast(tokens[3].toInt(nullptr, 16))); + thisFrame.setExtendedFrameFormat(thisFrame.frameId() > 0x7FF); thisFrame.isReceived = true; - thisFrame.remote = false; + thisFrame.setFrameType(QCanBusFrame::DataFrame); thisFrame.bus = 0; - thisFrame.len = tokens[4].toInt(nullptr, 16); - for (int d = 0; d < thisFrame.len; d++) + int numBytes = tokens[4].toInt(nullptr, 16); + QByteArray bytes(numBytes , 0); + for (int d = 0; d < numBytes; d++) { if (tokens[d + 5] != "") { - thisFrame.data[d] = static_cast(tokens[d + 5].toInt(nullptr, 16)); + bytes[d] = static_cast(tokens[d + 5].toInt(nullptr, 16)); } - else thisFrame.data[d] = 0; + else bytes[d] = 0; } + thisFrame.setPayload(bytes); frames->append(thisFrame); } else foundErrors = true;