Merge pull request #263 from KiLMaN/master

Fix PCAN loading issues
This commit is contained in:
Collin Kidder
2021-02-14 10:52:04 -05:00
committed by GitHub
+3 -3
View File
@@ -1258,7 +1258,7 @@ bool FrameFileIO::isPCANFile(QString filename)
{ {
while (!inFile->atEnd()) { while (!inFile->atEnd()) {
lineCounter++; lineCounter++;
if (lineCounter > 10) if (lineCounter > 25)
{ {
break; break;
} }
@@ -1398,7 +1398,7 @@ bool FrameFileIO::loadPCANFile(QString filename, QVector<CANFrame>* frames)
{ {
int numBytes = line.mid(37,2).trimmed().toInt(); int numBytes = line.mid(37,2).trimmed().toInt();
QByteArray bytes(numBytes, 0); QByteArray bytes(numBytes, 0);
qDebug() << thisFrame.payload().length(); //qDebug() << thisFrame.payload().length();
thisFrame.isReceived = true; thisFrame.isReceived = true;
thisFrame.bus = 0; thisFrame.bus = 0;
if (line.at(25) == ' ') { if (line.at(25) == ' ') {
@@ -1409,7 +1409,7 @@ bool FrameFileIO::loadPCANFile(QString filename, QVector<CANFrame>* frames)
if (line.at(40) == 'R') { if (line.at(40) == 'R') {
thisFrame.setFrameType(QCanBusFrame::RemoteRequestFrame); thisFrame.setFrameType(QCanBusFrame::RemoteRequestFrame);
} else { } else {
QList<QByteArray> tokens = line.mid(40, thisFrame.payload().length() * 3).split(' '); QList<QByteArray> tokens = line.mid(40, numBytes * 3).split(' ');
thisFrame.setFrameType(QCanBusFrame::DataFrame); thisFrame.setFrameType(QCanBusFrame::DataFrame);
for (int d = 0; d < numBytes; d++) for (int d = 0; d < numBytes; d++)
{ {