Fix a variety of DBC related issues, update version number at last (with plans to release soon!)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#ifndef CONFIG
|
||||
#define CONFIG
|
||||
|
||||
#define VERSION 213
|
||||
#define VERSION 220
|
||||
|
||||
//try to keep this in sync.
|
||||
//SavvyCAN will complain if you connect a GVRET board with a revision
|
||||
|
||||
+13
-1
@@ -17,7 +17,10 @@ void DBC_SIGNAL::addMultiplexRange(int min, int max)
|
||||
if (min != max)
|
||||
hasExtendedMultiplexing = true;
|
||||
isMultiplexed = true;
|
||||
multiplexLowAndHighValues.append(QPair<int, int>(min, max));
|
||||
//it is very likely that things that include extended multiplexing will have at least two definitions
|
||||
//which are identical. So, detect this and don't store on subsequent calls
|
||||
if (!multiplexLowAndHighValues.contains(QPair<int, int>(min, max)))
|
||||
multiplexLowAndHighValues.append(QPair<int, int>(min, max));
|
||||
}
|
||||
|
||||
bool DBC_SIGNAL::isSignalInMessage(const CANFrame &frame)
|
||||
@@ -76,6 +79,15 @@ void DBC_SIGNAL::copyMultiplexValuesFromSignal(const DBC_SIGNAL &signal)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* multiplexLowAndHighValues is private but the DBC saving code needs to be able to save a reasonable value for the multiplex value
|
||||
* for non-extended multiplex values. So, we grab the first element of the first item which should be the non-extended value
|
||||
*/
|
||||
int DBC_SIGNAL::getSimpleMultiplexValue()
|
||||
{
|
||||
return multiplexLowAndHighValues.at(0).first;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DBC_SIGNAL::parseDbcMultiplexUiString
|
||||
* Method for parsing the Vector CANDB++ like multiplex definitions:
|
||||
|
||||
+2
-3
@@ -88,7 +88,7 @@ class DBC_SIGNAL;
|
||||
|
||||
class DBC_SIGNAL
|
||||
{
|
||||
public: //TODO: this is sloppy. It shouldn't all be public!
|
||||
public: //TODO: Clean up this class so that not everything is public. There is one private member which is a start...
|
||||
DBC_SIGNAL() = default;
|
||||
|
||||
enum DbcMuxStringFormat {
|
||||
@@ -103,8 +103,6 @@ public: //TODO: this is sloppy. It shouldn't all be public!
|
||||
bool isMultiplexor = false;
|
||||
bool isMultiplexed = false;
|
||||
void addMultiplexRange(int min, int max);
|
||||
int multiplexHighValue = 0;
|
||||
int multiplexLowValue = 0;
|
||||
bool hasExtendedMultiplexing = false;
|
||||
QList<DBC_SIGNAL *> multiplexedChildren;
|
||||
DBC_SIGNAL *multiplexParent = nullptr;
|
||||
@@ -137,6 +135,7 @@ public: //TODO: this is sloppy. It shouldn't all be public!
|
||||
DBC_ATTRIBUTE_VALUE *findAttrValByIdx(int idx);
|
||||
bool isSignalInMessage(const CANFrame &frame);
|
||||
bool isValueMatchingMultiplex(int val) const;
|
||||
int getSimpleMultiplexValue();
|
||||
|
||||
|
||||
friend bool operator<(const DBC_SIGNAL& l, const DBC_SIGNAL& r)
|
||||
|
||||
+2
-1
@@ -1492,7 +1492,8 @@ bool DBCFile::saveFile(QString fileName)
|
||||
|
||||
if (sig->isMultiplexed)
|
||||
{
|
||||
msgOutput.append(" m" + QString::number(sig->multiplexLowValue));
|
||||
msgOutput.append(" m" + QString::number(sig->getSimpleMultiplexValue()));
|
||||
|
||||
}
|
||||
if (sig->isMultiplexor)
|
||||
{
|
||||
|
||||
@@ -293,8 +293,12 @@ void DBCMainEditor::onTreeDoubleClicked(const QModelIndex &index)
|
||||
msgID = getParentMessageID(firstCol);
|
||||
msg = dbcFile->messageHandler->findMsgByID(msgID);
|
||||
QString nameString = firstCol->text(0);
|
||||
if (nameString.contains("(")) nameString = nameString.split(" ")[1];
|
||||
else nameString = nameString.split(" ")[0];
|
||||
if (nameString.contains("("))
|
||||
{
|
||||
nameString = nameString.split(")")[1].trimmed(); //remove (1-2) type stuff from beginning of string
|
||||
}
|
||||
nameString = nameString.split(" ")[0]; //get rid of [32m 8] type stuff after the name
|
||||
|
||||
sig = msg->sigHandler->findSignalByName(nameString);
|
||||
if (sig)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user