Fixes to file loading
This commit is contained in:
+2
-1
@@ -94,7 +94,8 @@ bool BLFHandler::loadBLF(QString filename, QVector<CANFrame>* frames)
|
|||||||
frame.remote = false;
|
frame.remote = false;
|
||||||
for (int i = 0; i < 8; i++) frame.data[i] = canObject.data[i];
|
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);
|
frames->append(frame);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
+9
-5
@@ -649,6 +649,7 @@ bool FrameFileIO::loadCanalyzerASC(QString filename, QVector<CANFrame>* frames)
|
|||||||
bool foundErrors = false;
|
bool foundErrors = false;
|
||||||
bool inHeader = true;
|
bool inHeader = true;
|
||||||
thisFrame.remote = false;
|
thisFrame.remote = false;
|
||||||
|
QList<QByteArray> tokens;
|
||||||
|
|
||||||
if (!inFile->open(QIODevice::ReadOnly | QIODevice::Text))
|
if (!inFile->open(QIODevice::ReadOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
@@ -664,16 +665,19 @@ bool FrameFileIO::loadCanalyzerASC(QString filename, QVector<CANFrame>* frames)
|
|||||||
lineCounter = 0;
|
lineCounter = 0;
|
||||||
}
|
}
|
||||||
line = inFile->readLine();
|
line = inFile->readLine();
|
||||||
if (line.startsWith("//"))
|
if (inHeader)
|
||||||
{
|
{
|
||||||
inHeader = false;
|
if (line.startsWith("//") || lineCounter > 4)
|
||||||
continue;
|
{
|
||||||
|
inHeader = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (inHeader) continue;
|
if (inHeader) continue;
|
||||||
if (line.length() > 2)
|
if (line.length() > 2)
|
||||||
{
|
{
|
||||||
QList<QByteArray> tokens = line.simplified().split(' ');
|
tokens = line.simplified().split(' ');
|
||||||
if (tokens.length() > 4)
|
if (tokens.length() > 5)
|
||||||
{
|
{
|
||||||
thisFrame.timestamp = (uint64_t)(tokens[0].toDouble() * (double)1000000.0);
|
thisFrame.timestamp = (uint64_t)(tokens[0].toDouble() * (double)1000000.0);
|
||||||
thisFrame.ID = tokens[2].toUInt(NULL, 16);
|
thisFrame.ID = tokens[2].toUInt(NULL, 16);
|
||||||
|
|||||||
Reference in New Issue
Block a user