Skip to content

Commit

Permalink
Merge pull request #671 from GTO2013/canhacker_fix
Browse files Browse the repository at this point in the history
Add comma check to TRC CanHacker loader
  • Loading branch information
collin80 authored Dec 7, 2023
2 parents c3de835 + 3358cdc commit 9da747d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion framefileio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ bool FrameFileIO::isCANHackerFile(QString filename)

// CANHacker trace format
// Time ID DLC Data Comment
// 00.000 00004000 8 36 47 19 43 01 00 00 80
// 00[.|,]000 00004000 8 36 47 19 43 01 00 00 80
bool FrameFileIO::loadCANHackerFile(QString filename, QVector<CANFrame>* frames)
{
QFile *inFile = new QFile(filename);
Expand Down Expand Up @@ -1089,6 +1089,11 @@ bool FrameFileIO::loadCANHackerFile(QString filename, QVector<CANFrame>* frames)
if (tokens.length() > 3)
{
int idxOfDecimal = tokens[0].indexOf('.');
// If no dot is found, try comma
if(idxOfDecimal == -1)
{
idxOfDecimal = tokens[0].indexOf(',');
}
if (idxOfDecimal > -1) {
//int decimalPlaces = tokens[0].length() - tokens[0].indexOf('.') - 1;
//the result of the above is the # of digits after the decimal.
Expand Down

0 comments on commit 9da747d

Please sign in to comment.