Added DBC signal value table strings to graphs of signals with value
tables, incremented version number.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#ifndef CONFIG
|
#ifndef CONFIG
|
||||||
#define CONFIG
|
#define CONFIG
|
||||||
|
|
||||||
#define VERSION 203
|
#define VERSION 204
|
||||||
|
|
||||||
//try to keep this in sync.
|
//try to keep this in sync.
|
||||||
//SavvyCAN will complain if you connect a GVRET board with a revision
|
//SavvyCAN will complain if you connect a GVRET board with a revision
|
||||||
|
|||||||
@@ -180,6 +180,22 @@ bool DBC_SIGNAL::processAsText(const CANFrame &frame, QString &outString, bool o
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DBC_SIGNAL::getValueString(int64_t intVal, QString &outString)
|
||||||
|
{
|
||||||
|
if (valList.count() > 0) //if this is a value list type then look it up and display the proper string
|
||||||
|
{
|
||||||
|
for (int x = 0; x < valList.count(); x++)
|
||||||
|
{
|
||||||
|
if (valList.at(x).value == intVal)
|
||||||
|
{
|
||||||
|
outString = valList.at(x).descript;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
QString DBC_SIGNAL::makePrettyOutput(double floatVal, int64_t intVal, bool outputName, bool isInteger)
|
QString DBC_SIGNAL::makePrettyOutput(double floatVal, int64_t intVal, bool outputName, bool isInteger)
|
||||||
{
|
{
|
||||||
QString outputString;
|
QString outputString;
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ public: //TODO: this is sloppy. It shouldn't all be public!
|
|||||||
bool processAsText(const CANFrame &frame, QString &outString, bool outputName = true);
|
bool processAsText(const CANFrame &frame, QString &outString, bool outputName = true);
|
||||||
bool processAsInt(const CANFrame &frame, int32_t &outValue);
|
bool processAsInt(const CANFrame &frame, int32_t &outValue);
|
||||||
bool processAsDouble(const CANFrame &frame, double &outValue);
|
bool processAsDouble(const CANFrame &frame, double &outValue);
|
||||||
|
bool getValueString(int64_t intVal, QString &outString);
|
||||||
QString makePrettyOutput(double floatVal, int64_t intVal, bool outputName = true, bool isInteger = false);
|
QString makePrettyOutput(double floatVal, int64_t intVal, bool outputName = true, bool isInteger = false);
|
||||||
QString processSignalTree(const CANFrame &frame);
|
QString processSignalTree(const CANFrame &frame);
|
||||||
DBC_ATTRIBUTE_VALUE *findAttrValByName(QString name);
|
DBC_ATTRIBUTE_VALUE *findAttrValByName(QString name);
|
||||||
|
|||||||
+31
-1
@@ -1167,6 +1167,7 @@ void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam)
|
|||||||
GraphParams *refParam = ¶ms;
|
GraphParams *refParam = ¶ms;
|
||||||
int sBit, bits;
|
int sBit, bits;
|
||||||
bool intelFormat, isSigned;
|
bool intelFormat, isSigned;
|
||||||
|
int64_t prevValu = 9999999999;
|
||||||
|
|
||||||
qDebug() << "New Graph ID: " << params.ID;
|
qDebug() << "New Graph ID: " << params.ID;
|
||||||
qDebug() << "Start bit: " << params.startBit;
|
qDebug() << "Start bit: " << params.startBit;
|
||||||
@@ -1213,6 +1214,8 @@ void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam)
|
|||||||
int k = j * params.stride;
|
int k = j * params.stride;
|
||||||
tempVal = Utility::processIntegerSignal(frameCache[k].payload(), sBit, bits, intelFormat, isSigned); //& params.mask;
|
tempVal = Utility::processIntegerSignal(frameCache[k].payload(), sBit, bits, intelFormat, isSigned); //& params.mask;
|
||||||
//qDebug() << tempVal;
|
//qDebug() << tempVal;
|
||||||
|
params.y[j] = (tempVal * params.scale) + params.bias;
|
||||||
|
|
||||||
if (secondsMode)
|
if (secondsMode)
|
||||||
{
|
{
|
||||||
params.x[j] = (frameCache[k].timeStamp().microSeconds()) / 1000000.0;
|
params.x[j] = (frameCache[k].timeStamp().microSeconds()) / 1000000.0;
|
||||||
@@ -1221,7 +1224,34 @@ void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam)
|
|||||||
{
|
{
|
||||||
params.x[j] = frameCache[k].timeStamp().microSeconds();
|
params.x[j] = frameCache[k].timeStamp().microSeconds();
|
||||||
}
|
}
|
||||||
params.y[j] = (tempVal * params.scale) + params.bias;
|
|
||||||
|
if (params.associatedSignal)
|
||||||
|
{
|
||||||
|
QString tempStr;
|
||||||
|
bool isValid = params.associatedSignal->getValueString(tempVal, tempStr);
|
||||||
|
if (isValid)
|
||||||
|
{
|
||||||
|
if (tempVal != prevValu)
|
||||||
|
{
|
||||||
|
qDebug() << "New Value: " << tempStr;
|
||||||
|
// add the bracket at the top:
|
||||||
|
//QCPItemBracket *bracket = new QCPItemBracket(ui->graphingView);
|
||||||
|
//bracket->left->setCoords(-8, 1.1);
|
||||||
|
//bracket->right->setCoords(8, 1.1);
|
||||||
|
//bracket->setLength(13);
|
||||||
|
|
||||||
|
// add the text label at the top:
|
||||||
|
QCPItemText *wavePacketText = new QCPItemText(ui->graphingView);
|
||||||
|
//wavePacketText->position->setParentAnchor(bracket->center);
|
||||||
|
wavePacketText->position->setCoords(params.x[j], params.y[j]); // move 10 pixels to the top from bracket center anchor
|
||||||
|
wavePacketText->setPositionAlignment(Qt::AlignBottom|Qt::AlignHCenter);
|
||||||
|
wavePacketText->setText(tempStr);
|
||||||
|
wavePacketText->setFont(QFont(font().family(), 10));
|
||||||
|
}
|
||||||
|
prevValu = tempVal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (params.y[j] < yminval) yminval = params.y[j];
|
if (params.y[j] < yminval) yminval = params.y[j];
|
||||||
if (params.y[j] > ymaxval) ymaxval = params.y[j];
|
if (params.y[j] > ymaxval) ymaxval = params.y[j];
|
||||||
if (params.x[j] < xminval) xminval = params.x[j];
|
if (params.x[j] < xminval) xminval = params.x[j];
|
||||||
|
|||||||
Reference in New Issue
Block a user