Implemented the signal viewer and enabled it in the menu.

This commit is contained in:
Collin Kidder
2019-04-15 20:56:39 -04:00
parent 7c49c59197
commit c12031158e
6 changed files with 123 additions and 33 deletions
+4 -4
View File
@@ -36,7 +36,7 @@ s 5 47 46 45 44 43 42 41 40
So, the bits are 12, 11, 10, 9, 8, 23, 22, 21. Yes, that's confusing. They now go in reverse value order too.
Bit 12 is worth 128, 11 is worth 64, etc until bit 21 is worth 1.
*/
bool DBC_SIGNAL::processAsText(const CANFrame &frame, QString &outString)
bool DBC_SIGNAL::processAsText(const CANFrame &frame, QString &outString, bool outputName)
{
int64_t result = 0;
bool isSigned = false;
@@ -95,16 +95,16 @@ bool DBC_SIGNAL::processAsText(const CANFrame &frame, QString &outString)
endResult = (*((double *)(&result)) * factor) + bias;
}
outString = makePrettyOutput(endResult, result);
outString = makePrettyOutput(endResult, result, outputName);
cachedValue = endResult;
return true;
}
QString DBC_SIGNAL::makePrettyOutput(double floatVal, int64_t intVal)
QString DBC_SIGNAL::makePrettyOutput(double floatVal, int64_t intVal, bool outputName)
{
QString outputString;
outputString = name + ": ";
if (outputName) outputString = name + ": ";
if (valList.count() > 0) //if this is a value list type then look it up and display the proper string
{
+2 -2
View File
@@ -101,10 +101,10 @@ public: //TODO: this is sloppy. It shouldn't all be public!
QList<DBC_ATTRIBUTE_VALUE> attributes;
QList<DBC_VAL_ENUM_ENTRY> valList;
bool processAsText(const CANFrame &frame, QString &outString);
bool processAsText(const CANFrame &frame, QString &outString, bool outputName = true);
bool processAsInt(const CANFrame &frame, int32_t &outValue);
bool processAsDouble(const CANFrame &frame, double &outValue);
QString makePrettyOutput(double floatVal, int64_t intVal);
QString makePrettyOutput(double floatVal, int64_t intVal, bool outputName = true);
DBC_ATTRIBUTE_VALUE *findAttrValByName(QString name);
DBC_ATTRIBUTE_VALUE *findAttrValByIdx(int idx);
};