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;
|
cachedValue = outString;
|
||||||
return true;
|
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) isSigned = true;
|
||||||
if (valType == SIGNED_INT || valType == UNSIGNED_INT)
|
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;
|
int32_t result = 0;
|
||||||
bool isSigned = false;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -262,7 +273,7 @@ bool DBC_SIGNAL::processAsDouble(const CANFrame &frame, double &outValue)
|
|||||||
bool isSigned = false;
|
bool isSigned = false;
|
||||||
double endResult;
|
double endResult;
|
||||||
|
|
||||||
if (valType == STRING)
|
if (valType == STRING || valType == VALUE_STRING)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -21,7 +21,8 @@ enum DBC_SIG_VAL_TYPE
|
|||||||
SIGNED_INT,
|
SIGNED_INT,
|
||||||
SP_FLOAT,
|
SP_FLOAT,
|
||||||
DP_FLOAT,
|
DP_FLOAT,
|
||||||
STRING
|
STRING,
|
||||||
|
VALUE_STRING
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DBC_ATTRIBUTE_VAL_TYPE
|
enum DBC_ATTRIBUTE_VAL_TYPE
|
||||||
|
|||||||
@@ -576,6 +576,9 @@ DBC_SIGNAL* DBCFile::parseSignalLine(QString line, DBC_MESSAGE *msg)
|
|||||||
sig.valType = DP_FLOAT;
|
sig.valType = DP_FLOAT;
|
||||||
sig.intelByteOrder = true;
|
sig.intelByteOrder = true;
|
||||||
break;
|
break;
|
||||||
|
case 7: //double point float in little endian
|
||||||
|
sig.valType = VALUE_STRING;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
sig.factor = match.captured(6 + offset).toDouble();
|
sig.factor = match.captured(6 + offset).toDouble();
|
||||||
sig.bias = match.captured(7 + offset).toDouble();
|
sig.bias = match.captured(7 + offset).toDouble();
|
||||||
@@ -1443,6 +1446,9 @@ bool DBCFile::saveFile(QString fileName)
|
|||||||
case STRING:
|
case STRING:
|
||||||
msgOutput.append("4-");
|
msgOutput.append("4-");
|
||||||
break;
|
break;
|
||||||
|
case VALUE_STRING:
|
||||||
|
msgOutput.append("7-");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
msgOutput.append("0-");
|
msgOutput.append("0-");
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -285,6 +285,7 @@ void DBCLoadSaveWindow::editFile()
|
|||||||
if (idx < 0) return;
|
if (idx < 0) return;
|
||||||
|
|
||||||
editorWindow->setFileIdx(idx);
|
editorWindow->setFileIdx(idx);
|
||||||
|
editorWindow->setModal(true);
|
||||||
editorWindow->show();
|
editorWindow->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ DBCSignalEditor::DBCSignalEditor(QWidget *parent) :
|
|||||||
ui->comboType->addItem("SINGLE PRECISION");
|
ui->comboType->addItem("SINGLE PRECISION");
|
||||||
ui->comboType->addItem("DOUBLE PRECISION");
|
ui->comboType->addItem("DOUBLE PRECISION");
|
||||||
ui->comboType->addItem("STRING");
|
ui->comboType->addItem("STRING");
|
||||||
|
ui->comboType->addItem("ENUMERATED STRING");
|
||||||
|
|
||||||
ui->bitfield->setMode(GridMode::SIGNAL_VIEW);
|
ui->bitfield->setMode(GridMode::SIGNAL_VIEW);
|
||||||
|
|
||||||
@@ -85,6 +86,9 @@ DBCSignalEditor::DBCSignalEditor(QWidget *parent) :
|
|||||||
case 4:
|
case 4:
|
||||||
currentSignal->valType = STRING;
|
currentSignal->valType = STRING;
|
||||||
break;
|
break;
|
||||||
|
case 5:
|
||||||
|
currentSignal->valType = VALUE_STRING;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
dbcFile->setDirtyFlag();
|
dbcFile->setDirtyFlag();
|
||||||
fillSignalForm(currentSignal);
|
fillSignalForm(currentSignal);
|
||||||
@@ -577,6 +581,9 @@ void DBCSignalEditor::fillSignalForm(DBC_SIGNAL *sig)
|
|||||||
case STRING:
|
case STRING:
|
||||||
ui->comboType->setCurrentIndex(4);
|
ui->comboType->setCurrentIndex(4);
|
||||||
break;
|
break;
|
||||||
|
case VALUE_STRING:
|
||||||
|
ui->comboType->setCurrentIndex(5);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < ui->comboReceiver->count(); i++)
|
for (int i = 0; i < ui->comboReceiver->count(); i++)
|
||||||
|
|||||||
@@ -286,12 +286,13 @@ void SignalViewerWindow::loadDefinitions(bool append)
|
|||||||
if (msg = dbcHandler->findMessage(msgName))
|
if (msg = dbcHandler->findMessage(msgName))
|
||||||
{
|
{
|
||||||
sig = msg->sigHandler->findSignalByName(sigName);
|
sig = msg->sigHandler->findSignalByName(sigName);
|
||||||
|
if(sig)
|
||||||
loadedSignals.append(sig);
|
loadedSignals.append(sig);
|
||||||
}
|
}
|
||||||
else if(msg = dbcHandler->findMessage(msgId))
|
else if(msg = dbcHandler->findMessage(msgId))
|
||||||
{
|
{
|
||||||
sig = msg->sigHandler->findSignalByName(sigName);
|
sig = msg->sigHandler->findSignalByName(sigName);
|
||||||
//fix anything up about the name?
|
if(sig)
|
||||||
loadedSignals.append(sig);
|
loadedSignals.append(sig);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user