Fix a bug where intel and motorola format specifiers were reversed when loading and saving DBC files, fixed the dbc signal editor to properly set and show signals. That was broken too. Version is updated. There are still fixes to do so look for the next commit.

This commit is contained in:
Collin Kidder
2015-08-25 20:14:00 -04:00
parent 9d3608cd90
commit b06d6ad9ad
3 changed files with 38 additions and 30 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef CONFIG
#define CONFIG
#define VERSION 136
#define VERSION 137
//try to keep this in sync.
//SavvyCAN will complain if you connect a GVRET board with a revision
+8 -8
View File
@@ -87,12 +87,12 @@ void DBCHandler::loadDBCFile(QString filename)
}
switch (val)
{
case 0:
sig.intelByteOrder = true;
break;
case 1:
case 0: //big endian mode
sig.intelByteOrder = false;
break;
case 1: //little endian mode
sig.intelByteOrder = true;
break;
case 2:
sig.valType = SP_FLOAT;
break;
@@ -344,12 +344,12 @@ void DBCHandler::saveDBCFile(QString filename)
switch (sig.valType)
{
case UNSIGNED_INT:
if (sig.intelByteOrder) msgOutput.append("0+");
else msgOutput.append("1+");
if (sig.intelByteOrder) msgOutput.append("1+");
else msgOutput.append("0+");
break;
case SIGNED_INT:
if (sig.intelByteOrder) msgOutput.append("0-");
else msgOutput.append("1-");
if (sig.intelByteOrder) msgOutput.append("1-");
else msgOutput.append("0-");
break;
case SP_FLOAT:
msgOutput.append("2-");
+29 -21
View File
@@ -345,33 +345,41 @@ void DBCSignalEditor::fillSignalForm(DBC_SIGNAL *sig)
ui->txtUnitName->setText(sig->unitName);
memset(bitpattern, 0, 8); //clear it out first.
int startBit, endBit, startByte, bitWithinByteStart;
int startBit, endBit;
startBit = sig->startBit;
startByte = startBit / 8;
bitWithinByteStart = startBit % 8;
if (!sig->intelByteOrder)
{
bitWithinByteStart = 7 - bitWithinByteStart;
startBit = (startByte * 8) + bitWithinByteStart;
}
endBit = startBit + sig->signalSize - 1;
if (endBit > 63)
{
endBit = 63;
}
//bitpattern[startBit / 8] |= 1 << (startBit % 8);
bitpattern[startBit / 8] |= 1 << (startBit % 8); //make the start bit a different color to set it apart
ui->bitfield->setReference(bitpattern, false);
for (int y = startBit; y <= endBit; y++)
if (sig->intelByteOrder)
{
int byt = y / 8;
bitpattern[byt] |= 1 << (y % 8);
}
ui->bitfield->updateData(bitpattern, true);
endBit = startBit + sig->signalSize - 1;
if (startBit < 0) startBit = 0;
if (endBit > 63) endBit = 63;
for (int y = startBit; y <= endBit; y++)
{
int byt = y / 8;
bitpattern[byt] |= 1 << (y % 8);
}
}
else //big endian / motorola format
{
//much more irritating than the intel version...
int size = sig->signalSize;
while (size > 0)
{
int byt = startBit / 8;
bitpattern[byt] |= 1 << (startBit % 8);
size--;
if ((startBit % 8) == 0) startBit += 15;
else startBit--;
}
}
ui->bitfield->updateData(bitpattern, true);
ui->cbIntelFormat->setChecked(sig->intelByteOrder);
switch (sig->valType)
@@ -447,7 +455,7 @@ void DBCSignalEditor::clickSignalList(int row)
void DBCSignalEditor::bitfieldClicked(int x, int y)
{
int bit = (x) + (y * 8);
int bit = (7 - x) + (y * 8);
if (currentSignal == NULL) return;
currentSignal->startBit = bit;
fillSignalForm(currentSignal);