Merge pull request #247 from collin80/WIP

Wip
This commit is contained in:
Collin Kidder
2020-09-30 19:03:33 -07:00
committed by GitHub
2 changed files with 12 additions and 10 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
#include "dbc_classes.h"
#include "dbchandler.h"
#include "utility.h"
#include <QtMath>
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)
{
+10 -9
View File
@@ -790,22 +790,23 @@ bool FrameFileIO::loadCARBUSAnalyzerFile(QString filename, QVector<CANFrame>* fr
if (tokens.length() > 3)
{
QString time = tokens[0].replace(",",".");
thisFrame.timestamp = static_cast<uint64_t>(time.toDouble() * 1000);
thisFrame.ID = static_cast<uint32_t>(tokens[3].toInt(nullptr, 16));
thisFrame.extended = (thisFrame.ID > 0x7FF);
thisFrame.setTimeStamp(static_cast<uint64_t>(time.toDouble() * 1000));
thisFrame.setFrameId(static_cast<uint32_t>(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<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);
}
else foundErrors = true;