From 56691b368096781791bdb870d18cff8d55d0ccdb Mon Sep 17 00:00:00 2001 From: Collin Kidder Date: Mon, 18 Mar 2019 20:38:31 -0400 Subject: [PATCH] Fixes to file loading --- blfhandler.cpp | 3 ++- framefileio.cpp | 14 +++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/blfhandler.cpp b/blfhandler.cpp index 439c2ef..49e9694 100644 --- a/blfhandler.cpp +++ b/blfhandler.cpp @@ -94,7 +94,8 @@ bool BLFHandler::loadBLF(QString filename, QVector* frames) frame.remote = false; for (int i = 0; i < 8; i++) frame.data[i] = canObject.data[i]; } - frame.timestamp = obj.header.uncompSize / 1000000.0; //uncompsize field also used for timestamp oddly enough + //Should we divide by a thousand or a million? Unsure here. It appears some logs are stamped in microseconds and some in milliseconds? + frame.timestamp = obj.header.uncompSize / 1000.0; //uncompsize field also used for timestamp oddly enough frames->append(frame); } else diff --git a/framefileio.cpp b/framefileio.cpp index f287c2f..ed6deb2 100644 --- a/framefileio.cpp +++ b/framefileio.cpp @@ -649,6 +649,7 @@ bool FrameFileIO::loadCanalyzerASC(QString filename, QVector* frames) bool foundErrors = false; bool inHeader = true; thisFrame.remote = false; + QList tokens; if (!inFile->open(QIODevice::ReadOnly | QIODevice::Text)) { @@ -664,16 +665,19 @@ bool FrameFileIO::loadCanalyzerASC(QString filename, QVector* frames) lineCounter = 0; } line = inFile->readLine(); - if (line.startsWith("//")) + if (inHeader) { - inHeader = false; - continue; + if (line.startsWith("//") || lineCounter > 4) + { + inHeader = false; + continue; + } } if (inHeader) continue; if (line.length() > 2) { - QList tokens = line.simplified().split(' '); - if (tokens.length() > 4) + tokens = line.simplified().split(' '); + if (tokens.length() > 5) { thisFrame.timestamp = (uint64_t)(tokens[0].toDouble() * (double)1000000.0); thisFrame.ID = tokens[2].toUInt(NULL, 16);