Fix loading of graph definitions
This commit is contained in:
+12
-9
@@ -846,7 +846,7 @@ void GraphingWindow::loadDefinitions()
|
|||||||
QStringList filters;
|
QStringList filters;
|
||||||
filters.append(QString(tr("Graph definition (*.gdf)")));
|
filters.append(QString(tr("Graph definition (*.gdf)")));
|
||||||
|
|
||||||
if (dbcHandler == NULL) return;
|
if (dbcHandler == nullptr) return;
|
||||||
if (dbcHandler->getFileCount() == 0) dbcHandler->createBlankFile();
|
if (dbcHandler->getFileCount() == 0) dbcHandler->createBlankFile();
|
||||||
|
|
||||||
dialog.setFileMode(QFileDialog::ExistingFile);
|
dialog.setFileMode(QFileDialog::ExistingFile);
|
||||||
@@ -872,10 +872,13 @@ void GraphingWindow::loadDefinitions()
|
|||||||
|
|
||||||
if (tokens[0] == "X") //newest format based around signals
|
if (tokens[0] == "X") //newest format based around signals
|
||||||
{
|
{
|
||||||
gp.ID = tokens[1].toInt(NULL, 16);
|
gp.ID = tokens[1].toUInt(nullptr, 16);
|
||||||
gp.mask = tokens[2].toULongLong(NULL, 16);
|
gp.mask = tokens[2].toULongLong(nullptr, 16);
|
||||||
gp.startBit = tokens[3].toInt();
|
gp.startBit = tokens[3].toInt();
|
||||||
if (gp.startBit < 0) gp.intelFormat = false;
|
if (gp.startBit < 0) {
|
||||||
|
gp.intelFormat = false;
|
||||||
|
gp.startBit *= -1;
|
||||||
|
}
|
||||||
else gp.intelFormat = true;
|
else gp.intelFormat = true;
|
||||||
gp.numBits = tokens[4].toInt();
|
gp.numBits = tokens[4].toInt();
|
||||||
if (tokens[5] == "Y") gp.isSigned = true;
|
if (tokens[5] == "Y") gp.isSigned = true;
|
||||||
@@ -895,18 +898,18 @@ void GraphingWindow::loadDefinitions()
|
|||||||
}
|
}
|
||||||
else //one of the two older formats then
|
else //one of the two older formats then
|
||||||
{
|
{
|
||||||
gp.ID = tokens[0].toInt(NULL, 16);
|
gp.ID = tokens[0].toUInt(nullptr, 16);
|
||||||
if (tokens[1] == "S") //old signal based graph definition
|
if (tokens[1] == "S") //old signal based graph definition
|
||||||
{
|
{
|
||||||
//tokens[2] is the signal name. Need to use the message ID and this name to look it up
|
//tokens[2] is the signal name. Need to use the message ID and this name to look it up
|
||||||
DBC_MESSAGE *msg = dbcHandler->getFileByIdx(0)->messageHandler->findMsgByID(gp.ID);
|
DBC_MESSAGE *msg = dbcHandler->getFileByIdx(0)->messageHandler->findMsgByID(gp.ID);
|
||||||
if (msg != NULL)
|
if (msg != nullptr)
|
||||||
{
|
{
|
||||||
DBC_SIGNAL *sig = msg->sigHandler->findSignalByName(tokens[2]);
|
DBC_SIGNAL *sig = msg->sigHandler->findSignalByName(tokens[2]);
|
||||||
if (sig)
|
if (sig)
|
||||||
{
|
{
|
||||||
gp.mask = 0xFFFFFFFF;
|
gp.mask = 0xFFFFFFFF;
|
||||||
gp.bias = sig->bias;
|
gp.bias = (float)sig->bias;
|
||||||
gp.color.setRed(tokens[3].toInt());
|
gp.color.setRed(tokens[3].toInt());
|
||||||
gp.color.setGreen(tokens[4].toInt());
|
gp.color.setGreen(tokens[4].toInt());
|
||||||
gp.color.setBlue(tokens[5].toInt());
|
gp.color.setBlue(tokens[5].toInt());
|
||||||
@@ -915,7 +918,7 @@ void GraphingWindow::loadDefinitions()
|
|||||||
if (sig->valType == SIGNED_INT) gp.isSigned = true;
|
if (sig->valType == SIGNED_INT) gp.isSigned = true;
|
||||||
else gp.isSigned = false;
|
else gp.isSigned = false;
|
||||||
gp.numBits = sig->signalSize;
|
gp.numBits = sig->signalSize;
|
||||||
gp.scale = sig->factor;
|
gp.scale = (float)sig->factor;
|
||||||
gp.startBit = sig->startBit;
|
gp.startBit = sig->startBit;
|
||||||
gp.stride = 1;
|
gp.stride = 1;
|
||||||
createGraph(gp, true);
|
createGraph(gp, true);
|
||||||
@@ -927,7 +930,7 @@ void GraphingWindow::loadDefinitions()
|
|||||||
//hard part - this all changed drastically
|
//hard part - this all changed drastically
|
||||||
//the difference between intel and motorola format is whether
|
//the difference between intel and motorola format is whether
|
||||||
//start is larger than end byte or not.
|
//start is larger than end byte or not.
|
||||||
uint64_t oldMask = tokens[1].toULongLong(NULL, 16);
|
uint64_t oldMask = tokens[1].toULongLong(nullptr, 16);
|
||||||
int oldStart = tokens[2].toInt();
|
int oldStart = tokens[2].toInt();
|
||||||
int oldEnd = tokens[3].toInt();
|
int oldEnd = tokens[3].toInt();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user