Properly output SIG_VALTYPE_ for float/double entries in DBC files
This commit is contained in:
+8
-9
@@ -1348,7 +1348,7 @@ bool DBCFile::saveFile(QString fileName)
|
|||||||
int sigNumber = 1;
|
int sigNumber = 1;
|
||||||
QFile *outFile = new QFile(fileName);
|
QFile *outFile = new QFile(fileName);
|
||||||
QString nodesOutput, msgOutput, commentsOutput, valuesOutput, extMultiplexOutput;
|
QString nodesOutput, msgOutput, commentsOutput, valuesOutput, extMultiplexOutput;
|
||||||
QString defaultsOutput, attrValOutput;
|
QString defaultsOutput, attrValOutput, sigValTypeOutput;
|
||||||
bool hasExtendedMultiplexing = false;
|
bool hasExtendedMultiplexing = false;
|
||||||
|
|
||||||
if (!outFile->open(QIODevice::WriteOnly | QIODevice::Text))
|
if (!outFile->open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
@@ -1512,17 +1512,11 @@ bool DBCFile::saveFile(QString fileName)
|
|||||||
else msgOutput.append("0+");
|
else msgOutput.append("0+");
|
||||||
break;
|
break;
|
||||||
case SIGNED_INT:
|
case SIGNED_INT:
|
||||||
|
case SP_FLOAT:
|
||||||
|
case DP_FLOAT:
|
||||||
if (sig->intelByteOrder) msgOutput.append("1-");
|
if (sig->intelByteOrder) msgOutput.append("1-");
|
||||||
else msgOutput.append("0-");
|
else msgOutput.append("0-");
|
||||||
break;
|
break;
|
||||||
case SP_FLOAT:
|
|
||||||
if (sig->intelByteOrder) msgOutput.append("5-");
|
|
||||||
else msgOutput.append("2-");
|
|
||||||
break;
|
|
||||||
case DP_FLOAT:
|
|
||||||
if (sig->intelByteOrder) msgOutput.append("6-");
|
|
||||||
else msgOutput.append("3-");
|
|
||||||
break;
|
|
||||||
case STRING:
|
case STRING:
|
||||||
msgOutput.append("4-");
|
msgOutput.append("4-");
|
||||||
break;
|
break;
|
||||||
@@ -1533,6 +1527,8 @@ bool DBCFile::saveFile(QString fileName)
|
|||||||
msgOutput.append(" (" + QString::number(sig->factor) + "," + QString::number(sig->bias) + ") [" +
|
msgOutput.append(" (" + QString::number(sig->factor) + "," + QString::number(sig->bias) + ") [" +
|
||||||
QString::number(sig->min) + "|" + QString::number(sig->max) + "] \"" + sig->unitName
|
QString::number(sig->min) + "|" + QString::number(sig->max) + "] \"" + sig->unitName
|
||||||
+ "\" " + sig->receiver->name + "\n");
|
+ "\" " + sig->receiver->name + "\n");
|
||||||
|
if (sig->valType == SP_FLOAT || sig->valType == DP_FLOAT)
|
||||||
|
sigValTypeOutput.append("SIG_VALTYPE_ " + QString::number(ID) + " " + sig->name + " : " + QString::number(sig->valType == SP_FLOAT ? 1 : 2) + ";\n");
|
||||||
if (sig->comment.length() > 0)
|
if (sig->comment.length() > 0)
|
||||||
{
|
{
|
||||||
commentsOutput.append("CM_ SG_ " + QString::number(ID) + " " + sig->name + " \"" + sig->comment + "\";\n");
|
commentsOutput.append("CM_ SG_ " + QString::number(ID) + " " + sig->name + " \"" + sig->comment + "\";\n");
|
||||||
@@ -1685,11 +1681,14 @@ bool DBCFile::saveFile(QString fileName)
|
|||||||
outFile->write(attrValOutput.toUtf8());
|
outFile->write(attrValOutput.toUtf8());
|
||||||
outFile->write(valuesOutput.toUtf8());
|
outFile->write(valuesOutput.toUtf8());
|
||||||
outFile->write(extMultiplexOutput.toUtf8());
|
outFile->write(extMultiplexOutput.toUtf8());
|
||||||
|
if (!sigValTypeOutput.isEmpty())
|
||||||
|
outFile->write(sigValTypeOutput.toUtf8());
|
||||||
|
|
||||||
attrValOutput.clear();
|
attrValOutput.clear();
|
||||||
defaultsOutput.clear();
|
defaultsOutput.clear();
|
||||||
valuesOutput.clear();
|
valuesOutput.clear();
|
||||||
extMultiplexOutput.clear();
|
extMultiplexOutput.clear();
|
||||||
|
sigValTypeOutput.clear();
|
||||||
|
|
||||||
outFile->close();
|
outFile->close();
|
||||||
delete outFile;
|
delete outFile;
|
||||||
|
|||||||
Reference in New Issue
Block a user