Progress!
Masked error caused by saving dbc while editor is open that causes msg IDs to go crazy by making editor modal, but that affects all other windows, so might be a better fix. Added new value type of VALUE_STRING, probably better named ENUMERATED_STRING, and it uses the table in the editor to define the enum. Fixed a bug in the signal viewer load when a signal is not matched (I found it by renaming a signal and then loading)
This commit is contained in:
+13
-2
@@ -137,6 +137,17 @@ bool DBC_SIGNAL::processAsText(const CANFrame &frame, QString &outString, bool o
|
||||
cachedValue = outString;
|
||||
return true;
|
||||
}
|
||||
else if(valType == VALUE_STRING)
|
||||
{
|
||||
result = Utility::processIntegerSignal(frame.payload(), startBit, signalSize, intelByteOrder, isSigned);
|
||||
|
||||
if(!getValueString(result, outString))
|
||||
{
|
||||
outString = "Signal string value is undefined";
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (valType == SIGNED_INT) isSigned = true;
|
||||
if (valType == SIGNED_INT || valType == UNSIGNED_INT)
|
||||
@@ -229,7 +240,7 @@ bool DBC_SIGNAL::processAsInt(const CANFrame &frame, int32_t &outValue)
|
||||
int32_t result = 0;
|
||||
bool isSigned = false;
|
||||
|
||||
if (valType == STRING || valType == SP_FLOAT || valType == DP_FLOAT)
|
||||
if (valType == STRING || valType == VALUE_STRING || valType == SP_FLOAT || valType == DP_FLOAT)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -262,7 +273,7 @@ bool DBC_SIGNAL::processAsDouble(const CANFrame &frame, double &outValue)
|
||||
bool isSigned = false;
|
||||
double endResult;
|
||||
|
||||
if (valType == STRING)
|
||||
if (valType == STRING || valType == VALUE_STRING)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
+2
-1
@@ -21,7 +21,8 @@ enum DBC_SIG_VAL_TYPE
|
||||
SIGNED_INT,
|
||||
SP_FLOAT,
|
||||
DP_FLOAT,
|
||||
STRING
|
||||
STRING,
|
||||
VALUE_STRING
|
||||
};
|
||||
|
||||
enum DBC_ATTRIBUTE_VAL_TYPE
|
||||
|
||||
@@ -576,6 +576,9 @@ DBC_SIGNAL* DBCFile::parseSignalLine(QString line, DBC_MESSAGE *msg)
|
||||
sig.valType = DP_FLOAT;
|
||||
sig.intelByteOrder = true;
|
||||
break;
|
||||
case 7: //double point float in little endian
|
||||
sig.valType = VALUE_STRING;
|
||||
break;
|
||||
}
|
||||
sig.factor = match.captured(6 + offset).toDouble();
|
||||
sig.bias = match.captured(7 + offset).toDouble();
|
||||
@@ -1443,6 +1446,9 @@ bool DBCFile::saveFile(QString fileName)
|
||||
case STRING:
|
||||
msgOutput.append("4-");
|
||||
break;
|
||||
case VALUE_STRING:
|
||||
msgOutput.append("7-");
|
||||
break;
|
||||
default:
|
||||
msgOutput.append("0-");
|
||||
break;
|
||||
|
||||
@@ -285,6 +285,7 @@ void DBCLoadSaveWindow::editFile()
|
||||
if (idx < 0) return;
|
||||
|
||||
editorWindow->setFileIdx(idx);
|
||||
editorWindow->setModal(true);
|
||||
editorWindow->show();
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ DBCSignalEditor::DBCSignalEditor(QWidget *parent) :
|
||||
ui->comboType->addItem("SINGLE PRECISION");
|
||||
ui->comboType->addItem("DOUBLE PRECISION");
|
||||
ui->comboType->addItem("STRING");
|
||||
ui->comboType->addItem("ENUMERATED STRING");
|
||||
|
||||
ui->bitfield->setMode(GridMode::SIGNAL_VIEW);
|
||||
|
||||
@@ -84,7 +85,10 @@ DBCSignalEditor::DBCSignalEditor(QWidget *parent) :
|
||||
break;
|
||||
case 4:
|
||||
currentSignal->valType = STRING;
|
||||
break;
|
||||
break;
|
||||
case 5:
|
||||
currentSignal->valType = VALUE_STRING;
|
||||
break;
|
||||
}
|
||||
dbcFile->setDirtyFlag();
|
||||
fillSignalForm(currentSignal);
|
||||
@@ -577,6 +581,9 @@ void DBCSignalEditor::fillSignalForm(DBC_SIGNAL *sig)
|
||||
case STRING:
|
||||
ui->comboType->setCurrentIndex(4);
|
||||
break;
|
||||
case VALUE_STRING:
|
||||
ui->comboType->setCurrentIndex(5);
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = 0; i < ui->comboReceiver->count(); i++)
|
||||
|
||||
@@ -286,13 +286,14 @@ void SignalViewerWindow::loadDefinitions(bool append)
|
||||
if (msg = dbcHandler->findMessage(msgName))
|
||||
{
|
||||
sig = msg->sigHandler->findSignalByName(sigName);
|
||||
loadedSignals.append(sig);
|
||||
if(sig)
|
||||
loadedSignals.append(sig);
|
||||
}
|
||||
else if(msg = dbcHandler->findMessage(msgId))
|
||||
{
|
||||
sig = msg->sigHandler->findSignalByName(sigName);
|
||||
//fix anything up about the name?
|
||||
loadedSignals.append(sig);
|
||||
if(sig)
|
||||
loadedSignals.append(sig);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user