Removing limitations to allow for floating point endianess

This commit is contained in:
Tobin Hall
2019-12-11 11:35:20 +13:00
parent 288dd3f20f
commit 8021710871
2 changed files with 2 additions and 6 deletions
+2 -2
View File
@@ -79,7 +79,7 @@ bool DBC_SIGNAL::processAsText(const CANFrame &frame, QString &outString, bool o
//that the bytes that make up the integer are instead treated as having made up //that the bytes that make up the integer are instead treated as having made up
//a 32 bit single precision float. That's evil incarnate but it is very fast and small //a 32 bit single precision float. That's evil incarnate but it is very fast and small
//in terms of new code. //in terms of new code.
result = Utility::processIntegerSignal(frame.data, startBit, 32, false, false); result = Utility::processIntegerSignal(frame.data, startBit, 32, intelByteOrder, false);
endResult = (*((float *)(&result)) * factor) + bias; endResult = (*((float *)(&result)) * factor) + bias;
} }
else //double precision float else //double precision float
@@ -91,7 +91,7 @@ bool DBC_SIGNAL::processAsText(const CANFrame &frame, QString &outString, bool o
} }
//like the above, this is rotten and evil and wrong in so many ways. Force //like the above, this is rotten and evil and wrong in so many ways. Force
//calculation of a 64 bit integer and then cast it into a double. //calculation of a 64 bit integer and then cast it into a double.
result = Utility::processIntegerSignal(frame.data, 0, 64, false, false); result = Utility::processIntegerSignal(frame.data, 0, 64, intelByteOrder, false);
endResult = (*((double *)(&result)) * factor) + bias; endResult = (*((double *)(&result)) * factor) + bias;
} }
-4
View File
@@ -49,8 +49,6 @@ DBCSignalEditor::DBCSignalEditor(QWidget *parent) :
{ {
if (currentSignal == nullptr) return; if (currentSignal == nullptr) return;
currentSignal->intelByteOrder = ui->cbIntelFormat->isChecked(); currentSignal->intelByteOrder = ui->cbIntelFormat->isChecked();
if (currentSignal->valType == SP_FLOAT || currentSignal->valType == DP_FLOAT)
currentSignal->intelByteOrder = false;
fillSignalForm(currentSignal); fillSignalForm(currentSignal);
}); });
@@ -74,13 +72,11 @@ DBCSignalEditor::DBCSignalEditor(QWidget *parent) :
break; break;
case 2: case 2:
currentSignal->valType = SP_FLOAT; currentSignal->valType = SP_FLOAT;
currentSignal->intelByteOrder = false;
if (currentSignal->startBit > 39) currentSignal->startBit = 39; if (currentSignal->startBit > 39) currentSignal->startBit = 39;
currentSignal->signalSize = 32; currentSignal->signalSize = 32;
break; break;
case 3: case 3:
currentSignal->valType = DP_FLOAT; currentSignal->valType = DP_FLOAT;
currentSignal->intelByteOrder = false;
currentSignal->startBit = 7; //has to be! currentSignal->startBit = 7; //has to be!
currentSignal->signalSize = 64; currentSignal->signalSize = 64;
break; break;