Fix some errors created during last merge.

This commit is contained in:
Collin Kidder
2020-09-30 21:55:39 -04:00
parent ad84bb8096
commit 1c7caa3884
2 changed files with 12 additions and 10 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
#include "dbc_classes.h" #include "dbc_classes.h"
#include "dbchandler.h" #include "dbchandler.h"
#include "utility.h" #include "utility.h"
#include <QtMath>
DBC_MESSAGE::DBC_MESSAGE() DBC_MESSAGE::DBC_MESSAGE()
{ {
@@ -73,7 +74,7 @@ bool DBC_SIGNAL::processAsText(const CANFrame &frame, QString &outString, bool o
endResult = ((double)result * factor) + bias; endResult = ((double)result * factor) + bias;
result = (int64_t)endResult; result = (int64_t)endResult;
// if factor is an integer, we don't need the possibly human-unreadable float representation // 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) else if (valType == SP_FLOAT)
{ {
+10 -9
View File
@@ -790,22 +790,23 @@ bool FrameFileIO::loadCARBUSAnalyzerFile(QString filename, QVector<CANFrame>* fr
if (tokens.length() > 3) if (tokens.length() > 3)
{ {
QString time = tokens[0].replace(",","."); QString time = tokens[0].replace(",",".");
thisFrame.setTimeStamp(static_cast<uint64_t>(time.toDouble() * 1000));
thisFrame.timestamp = static_cast<uint64_t>(time.toDouble() * 1000); thisFrame.setFrameId(static_cast<uint32_t>(tokens[3].toInt(nullptr, 16)));
thisFrame.ID = static_cast<uint32_t>(tokens[3].toInt(nullptr, 16)); thisFrame.setExtendedFrameFormat(thisFrame.frameId() > 0x7FF);
thisFrame.extended = (thisFrame.ID > 0x7FF);
thisFrame.isReceived = true; thisFrame.isReceived = true;
thisFrame.remote = false; thisFrame.setFrameType(QCanBusFrame::DataFrame);
thisFrame.bus = 0; thisFrame.bus = 0;
thisFrame.len = tokens[4].toInt(nullptr, 16); int numBytes = tokens[4].toInt(nullptr, 16);
for (int d = 0; d < thisFrame.len; d++) QByteArray bytes(numBytes , 0);
for (int d = 0; d < numBytes; d++)
{ {
if (tokens[d + 5] != "") if (tokens[d + 5] != "")
{ {
thisFrame.data[d] = static_cast<unsigned char>(tokens[d + 5].toInt(nullptr, 16)); bytes[d] = static_cast<unsigned char>(tokens[d + 5].toInt(nullptr, 16));
} }
else thisFrame.data[d] = 0; else bytes[d] = 0;
} }
thisFrame.setPayload(bytes);
frames->append(thisFrame); frames->append(thisFrame);
} }
else foundErrors = true; else foundErrors = true;