Fixed Vector ASC loading to work a bit better

This commit is contained in:
Collin Kidder
2019-02-13 20:58:30 -05:00
parent fa91de9e4f
commit 39f07fac32
+17 -14
View File
@@ -655,25 +655,28 @@ bool FrameFileIO::loadCanalyzerASC(QString filename, QVector<CANFrame>* frames)
} }
if (inHeader) continue; if (inHeader) continue;
if (line.length() > 2) if (line.length() > 2)
{ {
QList<QByteArray> tokens = line.simplified().split(' '); QList<QByteArray> tokens = line.simplified().split(' ');
thisFrame.timestamp = (uint32_t)(tokens[0].toFloat() * 1000000.0); if (tokens.length() > 4)
thisFrame.ID = tokens[2].toUInt(NULL, 16);
thisFrame.len = tokens[5].toUInt();
thisFrame.isReceived = tokens[3].toUpper().contains("RX");
thisFrame.bus = tokens[1].toUInt();
thisFrame.extended = (thisFrame.ID > 0x7FF);
thisFrame.remote = false;
for (unsigned int d = 6; d < (6 + thisFrame.len); d++)
{ {
if (tokens.count() > d) thisFrame.timestamp = (uint32_t)(tokens[0].toFloat() * 1000000.0);
{ thisFrame.ID = tokens[2].toUInt(NULL, 16);
thisFrame.data[d - 6] = tokens[d].toInt(NULL, 16); thisFrame.len = tokens[5].toUInt();
} thisFrame.isReceived = tokens[3].toUpper().contains("RX");
else //expected byte wasn't there to read. Set it zero and set error flag thisFrame.bus = tokens[1].toUInt();
thisFrame.extended = (thisFrame.ID > 0x7FF);
thisFrame.remote = false;
for (unsigned int d = 6; d < (6 + thisFrame.len); d++)
{ {
if (tokens.count() > d)
{
thisFrame.data[d - 6] = tokens[d].toInt(NULL, 16);
}
else //expected byte wasn't there to read. Set it zero and set error flag
{
thisFrame.data[d - 6] = 0; thisFrame.data[d - 6] = 0;
foundErrors = true; foundErrors = true;
}
} }
} }
frames->append(thisFrame); frames->append(thisFrame);