Merge pull request #597 from amiralnar/load-time-from-canhacker-fles-fix
fix timing loading from CanHacker files where seconds in frame resets after 59 to 0
This commit is contained in:
+8
-1
@@ -1062,6 +1062,9 @@ bool FrameFileIO::loadCANHackerFile(QString filename, QVector<CANFrame>* frames)
|
|||||||
QByteArray line;
|
QByteArray line;
|
||||||
int lineCounter = 0;
|
int lineCounter = 0;
|
||||||
bool foundErrors = false;
|
bool foundErrors = false;
|
||||||
|
int addendumTime = 0;
|
||||||
|
double previousTime = 0;
|
||||||
|
|
||||||
|
|
||||||
if (!inFile->open(QIODevice::ReadOnly | QIODevice::Text))
|
if (!inFile->open(QIODevice::ReadOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
@@ -1097,7 +1100,11 @@ bool FrameFileIO::loadCANHackerFile(QString filename, QVector<CANFrame>* frames)
|
|||||||
multiplier = 1; //special case. Assume no decimal means microseconds
|
multiplier = 1; //special case. Assume no decimal means microseconds
|
||||||
}
|
}
|
||||||
//qDebug() << "decimal places " << decimalPlaces;
|
//qDebug() << "decimal places " << decimalPlaces;
|
||||||
thisFrame.setTimeStamp(QCanBusFrame::TimeStamp(0, static_cast<uint64_t>(tokens[0].toDouble() * multiplier)));
|
if (previousTime > tokens[0].toDouble()) {
|
||||||
|
addendumTime += 60;
|
||||||
|
}
|
||||||
|
thisFrame.setTimeStamp(QCanBusFrame::TimeStamp(0, static_cast<uint64_t>((tokens[0].toDouble() + addendumTime) * multiplier)));
|
||||||
|
previousTime = tokens[0].toDouble();
|
||||||
thisFrame.setFrameId( static_cast<uint32_t>(tokens[1].toInt(nullptr, 16)) );
|
thisFrame.setFrameId( static_cast<uint32_t>(tokens[1].toInt(nullptr, 16)) );
|
||||||
thisFrame.setExtendedFrameFormat((thisFrame.frameId() > 0x7FF));
|
thisFrame.setExtendedFrameFormat((thisFrame.frameId() > 0x7FF));
|
||||||
thisFrame.isReceived = true;
|
thisFrame.isReceived = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user