Skip to content

Commit

Permalink
Removing limitations to allow for floating point endianess
Browse files Browse the repository at this point in the history
  • Loading branch information
TobinHall committed Dec 10, 2019
1 parent 14d0bb7 commit 67fd771
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 2 additions & 2 deletions dbc/dbc_classes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
//a 32 bit single precision float. That's evil incarnate but it is very fast and small
//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;
}
else //double precision float
Expand All @@ -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
//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;
}

Expand Down
4 changes: 0 additions & 4 deletions dbc/dbcsignaleditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ DBCSignalEditor::DBCSignalEditor(QWidget *parent) :
{
if (currentSignal == nullptr) return;
currentSignal->intelByteOrder = ui->cbIntelFormat->isChecked();
if (currentSignal->valType == SP_FLOAT || currentSignal->valType == DP_FLOAT)
currentSignal->intelByteOrder = false;
fillSignalForm(currentSignal);
});

Expand All @@ -74,13 +72,11 @@ DBCSignalEditor::DBCSignalEditor(QWidget *parent) :
break;
case 2:
currentSignal->valType = SP_FLOAT;
currentSignal->intelByteOrder = false;
if (currentSignal->startBit > 39) currentSignal->startBit = 39;
currentSignal->signalSize = 32;
break;
case 3:
currentSignal->valType = DP_FLOAT;
currentSignal->intelByteOrder = false;
currentSignal->startBit = 7; //has to be!
currentSignal->signalSize = 64;
break;
Expand Down

0 comments on commit 67fd771

Please sign in to comment.