Merge pull request #671 from GTO2013/canhacker_fix
Add comma check to TRC CanHacker loader
This commit is contained in:
+6
-1
@@ -1054,7 +1054,7 @@ bool FrameFileIO::isCANHackerFile(QString filename)
|
|||||||
|
|
||||||
// CANHacker trace format
|
// CANHacker trace format
|
||||||
// Time ID DLC Data Comment
|
// 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)
|
bool FrameFileIO::loadCANHackerFile(QString filename, QVector<CANFrame>* frames)
|
||||||
{
|
{
|
||||||
QFile *inFile = new QFile(filename);
|
QFile *inFile = new QFile(filename);
|
||||||
@@ -1089,6 +1089,11 @@ bool FrameFileIO::loadCANHackerFile(QString filename, QVector<CANFrame>* frames)
|
|||||||
if (tokens.length() > 3)
|
if (tokens.length() > 3)
|
||||||
{
|
{
|
||||||
int idxOfDecimal = tokens[0].indexOf('.');
|
int idxOfDecimal = tokens[0].indexOf('.');
|
||||||
|
// If no dot is found, try comma
|
||||||
|
if(idxOfDecimal == -1)
|
||||||
|
{
|
||||||
|
idxOfDecimal = tokens[0].indexOf(',');
|
||||||
|
}
|
||||||
if (idxOfDecimal > -1) {
|
if (idxOfDecimal > -1) {
|
||||||
//int decimalPlaces = tokens[0].length() - tokens[0].indexOf('.') - 1;
|
//int decimalPlaces = tokens[0].length() - tokens[0].indexOf('.') - 1;
|
||||||
//the result of the above is the # of digits after the decimal.
|
//the result of the above is the # of digits after the decimal.
|
||||||
|
|||||||
Reference in New Issue
Block a user