From 10fc01f15ef534400895e82a4e923e111078f141 Mon Sep 17 00:00:00 2001 From: Collin Kidder Date: Mon, 20 Jul 2015 19:54:45 -0400 Subject: [PATCH] Updated version, fixed some bugs in DBC related code. --- config.h | 2 +- dbchandler.cpp | 14 ++++++++------ dbcsignaleditor.cpp | 12 ++++++------ 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/config.h b/config.h index 7835eaa..b40b7ff 100644 --- a/config.h +++ b/config.h @@ -1,7 +1,7 @@ #ifndef CONFIG #define CONFIG -#define VERSION 125 +#define VERSION 126 //try to keep this in sync. //SavvyCAN will complain if you connect a GVRET board with a revision diff --git a/dbchandler.cpp b/dbchandler.cpp index 47e3ad7..8330134 100644 --- a/dbchandler.cpp +++ b/dbchandler.cpp @@ -337,20 +337,22 @@ void DBCHandler::saveDBCFile(QString filename) switch (sig.valType) { case UNSIGNED_INT: - msgOutput.append("0+"); + if (sig.intelByteOrder) msgOutput.append("0+"); + else msgOutput.append("1+"); break; case SIGNED_INT: - msgOutput.append("0-"); + if (sig.intelByteOrder) msgOutput.append("0-"); + else msgOutput.append("1-"); break; case SP_FLOAT: - msgOutput.append("1-"); - break; - case DP_FLOAT: msgOutput.append("2-"); break; - case STRING: + case DP_FLOAT: msgOutput.append("3-"); break; + case STRING: + msgOutput.append("4-"); + break; default: msgOutput.append("0-"); break; diff --git a/dbcsignaleditor.cpp b/dbcsignaleditor.cpp index f3afc0e..3f78be2 100644 --- a/dbcsignaleditor.cpp +++ b/dbcsignaleditor.cpp @@ -86,7 +86,7 @@ DBCSignalEditor::DBCSignalEditor(DBCHandler *handler, QWidget *parent) : { double temp; bool result; - temp = ui->txtBias->text().toDouble(); + temp = ui->txtBias->text().toDouble(&result); if (result) currentSignal->bias = temp; }); @@ -95,7 +95,7 @@ DBCSignalEditor::DBCSignalEditor(DBCHandler *handler, QWidget *parent) : { double temp; bool result; - temp = ui->txtMaxVal->text().toDouble(); + temp = ui->txtMaxVal->text().toDouble(&result); if (result) currentSignal->max = temp; }); @@ -104,7 +104,7 @@ DBCSignalEditor::DBCSignalEditor(DBCHandler *handler, QWidget *parent) : { double temp; bool result; - temp = ui->txtMinVal->text().toDouble(); + temp = ui->txtMinVal->text().toDouble(&result); if (result) currentSignal->min = temp; }); connect(ui->txtScale, &QLineEdit::editingFinished, @@ -112,7 +112,7 @@ DBCSignalEditor::DBCSignalEditor(DBCHandler *handler, QWidget *parent) : { double temp; bool result; - temp = ui->txtScale->text().toDouble(); + temp = ui->txtScale->text().toDouble(&result); if (result) currentSignal->factor = temp; }); connect(ui->txtComment, &QLineEdit::editingFinished, @@ -352,10 +352,10 @@ void DBCSignalEditor::fillSignalForm(DBC_SIGNAL *sig) endBit = 63; } - bitpattern[startBit / 8] |= 1 << (startBit % 8); + //bitpattern[startBit / 8] |= 1 << (startBit % 8); ui->bitfield->setReference(bitpattern, false); - for (int y = startBit + 1; y <= endBit; y++) + for (int y = startBit; y <= endBit; y++) { int byt = y / 8; bitpattern[byt] |= 1 << (y % 8);