From 6918c1d73a92e3df087926818dd4704d9fd5c505 Mon Sep 17 00:00:00 2001 From: amiralnar Date: Tue, 14 Mar 2023 13:31:13 +1000 Subject: [PATCH] fix loading CanHacker .trc files with seconds timing --- framefileio.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/framefileio.cpp b/framefileio.cpp index 40977d4..c5822ba 100644 --- a/framefileio.cpp +++ b/framefileio.cpp @@ -1062,6 +1062,9 @@ bool FrameFileIO::loadCANHackerFile(QString filename, QVector* frames) QByteArray line; int lineCounter = 0; bool foundErrors = false; + int addendumTime = 0; + double previousTime = 0; + if (!inFile->open(QIODevice::ReadOnly | QIODevice::Text)) { @@ -1097,7 +1100,11 @@ bool FrameFileIO::loadCANHackerFile(QString filename, QVector* frames) multiplier = 1; //special case. Assume no decimal means microseconds } //qDebug() << "decimal places " << decimalPlaces; - thisFrame.setTimeStamp(QCanBusFrame::TimeStamp(0, static_cast(tokens[0].toDouble() * multiplier))); + if (previousTime > tokens[0].toDouble()) { + addendumTime += 60; + } + thisFrame.setTimeStamp(QCanBusFrame::TimeStamp(0, static_cast((tokens[0].toDouble() + addendumTime) * multiplier))); + previousTime = tokens[0].toDouble(); thisFrame.setFrameId( static_cast(tokens[1].toInt(nullptr, 16)) ); thisFrame.setExtendedFrameFormat((thisFrame.frameId() > 0x7FF)); thisFrame.isReceived = true;