Adding types to allow for saving and loading of little endian floats

This commit is contained in:
Tobin Hall
2019-12-11 11:36:22 +13:00
parent 8021710871
commit 9fb61507a7
+12 -2
View File
@@ -465,6 +465,14 @@ DBC_SIGNAL* DBCFile::parseSignalLine(QString line, DBC_MESSAGE *msg)
case 4: case 4:
sig.valType = STRING; sig.valType = STRING;
break; break;
case 5: //single point float in little endian
sig.valType = SP_FLOAT;
sig.intelByteOrder = true;
break;
case 6: //double point float in little endian
sig.valType = DP_FLOAT;
sig.intelByteOrder = true;
break;
} }
sig.factor = match.captured(6 + offset).toDouble(); sig.factor = match.captured(6 + offset).toDouble();
sig.bias = match.captured(7 + offset).toDouble(); sig.bias = match.captured(7 + offset).toDouble();
@@ -1230,10 +1238,12 @@ void DBCFile::saveFile(QString fileName)
else msgOutput.append("0-"); else msgOutput.append("0-");
break; break;
case SP_FLOAT: case SP_FLOAT:
msgOutput.append("2-"); if (sig->intelByteOrder) msgOutput.append("5-");
else msgOutput.append("2-");
break; break;
case DP_FLOAT: case DP_FLOAT:
msgOutput.append("3-"); if (sig->intelByteOrder) msgOutput.append("6-");
else msgOutput.append("3-");
break; break;
case STRING: case STRING:
msgOutput.append("4-"); msgOutput.append("4-");