Fixed an issue with there being no visual confirmation that intel byte mode had been changed in DBC editor, made masking work much more intuitively in graphing screen.

This commit is contained in:
Collin Kidder
2015-07-13 20:39:00 -04:00
parent 159f4c5d6f
commit 9b1d752a02
3 changed files with 17 additions and 4 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef CONFIG #ifndef CONFIG
#define CONFIG #define CONFIG
#define VERSION 122 #define VERSION 123
//try to keep this in sync. //try to keep this in sync.
//SavvyCAN will complain if you connect a GVRET board with a revision //SavvyCAN will complain if you connect a GVRET board with a revision
+2 -1
View File
@@ -51,6 +51,7 @@ DBCSignalEditor::DBCSignalEditor(DBCHandler *handler, QWidget *parent) :
[=]() [=]()
{ {
currentSignal->intelByteOrder = ui->cbIntelFormat->isChecked(); currentSignal->intelByteOrder = ui->cbIntelFormat->isChecked();
fillSignalForm(currentSignal);
}); });
connect(ui->comboReceiver, &QComboBox::currentTextChanged, connect(ui->comboReceiver, &QComboBox::currentTextChanged,
@@ -255,7 +256,7 @@ void DBCSignalEditor::addNewSignal()
DBC_SIGNAL newSig; DBC_SIGNAL newSig;
newSig.name = newName; newSig.name = newName;
newSig.bias = 0.0; newSig.bias = 0.0;
newSig.factor = 0.0; newSig.factor = 1.0;
newSig.intelByteOrder = true; newSig.intelByteOrder = true;
newSig.max = 0.0; newSig.max = 0.0;
newSig.min = 0.0; newSig.min = 0.0;
+14 -2
View File
@@ -426,14 +426,20 @@ void GraphingWindow::createGraph(GraphParams &params, bool createGraphParam)
int tempValInt; int tempValInt;
int numBytes = (params.endByte - params.startByte) + 1; int numBytes = (params.endByte - params.startByte) + 1;
int shiftRef = 1 << (numBytes * 8); int shiftRef = 1 << (numBytes * 8);
uint64_t maskShifter;
uint8_t tempByte;
for (int j = 0; j < numEntries; j++) for (int j = 0; j < numEntries; j++)
{ {
tempValInt = 0; tempValInt = 0;
int expon = 1; int expon = 1;
maskShifter = params.mask;
for (int c = 0; c < numBytes; c++) for (int c = 0; c < numBytes; c++)
{ {
tempValInt += (frameCache[j * params.stride].data[params.endByte - c] * expon); tempByte = frameCache[j * params.stride].data[params.endByte - c];
tempByte &= maskShifter;
tempValInt += (tempByte * expon);
expon *= 256; expon *= 256;
maskShifter = maskShifter >> 8;
} }
tempValInt &= params.mask; tempValInt &= params.mask;
@@ -467,14 +473,20 @@ void GraphingWindow::createGraph(GraphParams &params, bool createGraphParam)
int tempValInt; int tempValInt;
int numBytes = (params.startByte - params.endByte) + 1; int numBytes = (params.startByte - params.endByte) + 1;
int shiftRef = 1 << (numBytes * 8); int shiftRef = 1 << (numBytes * 8);
uint64_t maskShifter;
uint8_t tempByte;
for (int j = 0; j < numEntries; j++) for (int j = 0; j < numEntries; j++)
{ {
tempValInt = 0; tempValInt = 0;
int expon = 1; int expon = 1;
maskShifter = params.mask;
for (int c = 0; c < numBytes; c++) for (int c = 0; c < numBytes; c++)
{ {
tempValInt += frameCache[j * params.stride].data[params.endByte + c] * expon; tempByte = frameCache[j * params.stride].data[params.endByte + c];
tempByte &= maskShifter;
tempValInt += tempByte * expon;
expon *= 256; expon *= 256;
maskShifter = maskShifter >> 8;
} }
tempValInt &= params.mask; tempValInt &= params.mask;