Fixes to make graphing of multiplexed signals work properly

This commit is contained in:
Collin Kidder
2021-05-02 20:58:23 -04:00
parent e4da6237ae
commit 0d34958c63
3 changed files with 41 additions and 34 deletions
+12 -17
View File
@@ -38,26 +38,21 @@ bool DBC_SIGNAL::isSignalInMessage(const CANFrame &frame)
{
if (parentMessage->multiplexorSignal != nullptr)
{
return _sigInMsgPriv(frame, parentMessage->multiplexorSignal);
if (multiplexParent->isSignalInMessage(frame)) //parent is in message so check if value is correct
{
int val;
if (!multiplexParent->processAsInt(frame, val)) return false;
if ((val >= multiplexLowValue) && (val <= multiplexHighValue))
{
return true;
}
else return false;
}
else return false;
}
else return false;
}
else return true;
}
bool DBC_SIGNAL::_sigInMsgPriv(const CANFrame &frame, DBC_SIGNAL *multiplexor)
{
int val;
if (!multiplexor->processAsInt(frame, val)) return false;
foreach (DBC_SIGNAL *child, multiplexedChildren)
{
if ((val >= child->multiplexLowValue) && (val <= child->multiplexHighValue))
{
if (child->isMultiplexor) return _sigInMsgPriv(frame, child); //recurse down a level and keep searching
if (child == this) return true; //if we are that child then we matched!
}
}
return false; //signal not found in this message
else return true; //if signal isn't multiplexed then it's definitely in the message
}
//Take all the children of this signal and see if they exist in the message. Can be called recursively to descend the dependency tree
+1 -3
View File
@@ -120,14 +120,12 @@ public: //TODO: this is sloppy. It shouldn't all be public!
QString processSignalTree(const CANFrame &frame);
DBC_ATTRIBUTE_VALUE *findAttrValByName(QString name);
DBC_ATTRIBUTE_VALUE *findAttrValByIdx(int idx);
bool isSignalInMessage(const CANFrame &frame);
friend bool operator<(const DBC_SIGNAL& l, const DBC_SIGNAL& r)
{
return (l.name.toLower() < r.name.toLower());
}
private:
bool isSignalInMessage(const CANFrame &frame);
bool _sigInMsgPriv(const CANFrame &frame, DBC_SIGNAL *multiplexor);
};
class DBCSignalHandler; //forward declaration to keep from having to include dbchandler.h in this file and thus create a loop