@@ -210,7 +210,7 @@ void GraphingWindow::updatedFrames(int numFrames)
210
210
for (int i = modelFrames->count () - numFrames; i < modelFrames->count (); i++)
211
211
{
212
212
thisFrame = modelFrames->at (i);
213
- if (graphParams[j].ID == thisFrame.frameId ())
213
+ if ( graphParams[j].ID == thisFrame.frameId () && ( (graphParams[j]. bus == - 1 ) || (graphParams[j]. bus == thisFrame. bus ) ) )
214
214
{
215
215
appendToGraph (graphParams[j], thisFrame, x, y);
216
216
appendedToGraph = true ;
@@ -614,7 +614,8 @@ void GraphingWindow::removeAllGraphs()
614
614
QMessageBox::StandardButton confirmDialog;
615
615
confirmDialog = QMessageBox::question (this , " Really?" , " Remove all graphs?" ,
616
616
QMessageBox::Yes|QMessageBox::No);
617
- if (confirmDialog == QMessageBox::Yes) {
617
+ if (confirmDialog == QMessageBox::Yes)
618
+ {
618
619
ui->graphingView ->clearGraphs ();
619
620
ui->graphingView ->clearItems ();
620
621
graphParams.clear ();
@@ -885,7 +886,7 @@ void GraphingWindow::saveDefinitions()
885
886
QList<GraphParams>::iterator iter;
886
887
for (iter = graphParams.begin (); iter != graphParams.end (); ++iter)
887
888
{
888
- outFile->write (" X ," );
889
+ outFile->write (" Z ," );
889
890
outFile->write (QString::number (iter->ID , 16 ).toUtf8 ());
890
891
outFile->putChar (' ,' );
891
892
outFile->write (QString::number (iter->mask , 16 ).toUtf8 ());
@@ -904,6 +905,8 @@ void GraphingWindow::saveDefinitions()
904
905
outFile->putChar (' ,' );
905
906
outFile->write (QString::number (iter->stride ).toUtf8 ());
906
907
outFile->putChar (' ,' );
908
+ outFile->write (QString::number (iter->bus ).toUtf8 ());
909
+ outFile->putChar (' ,' );
907
910
outFile->write (QString::number (iter->lineColor .red ()).toUtf8 ());
908
911
outFile->putChar (' ,' );
909
912
outFile->write (QString::number (iter->lineColor .green ()).toUtf8 ());
@@ -978,7 +981,56 @@ void GraphingWindow::loadDefinitions()
978
981
979
982
gp.associatedSignal = nullptr ; // might not be saved in the graph definition so default it to nothing
980
983
981
- if (tokens[0 ] == " X" ) // newest format based around signals
984
+ // should probably do better at merging all the code that is the same between all these formats instead of duplication...
985
+ if (tokens[0 ] == " Z" ) // very newest format, adds ability to set bus number
986
+ {
987
+ gp.ID = tokens[1 ].toUInt (nullptr , 16 );
988
+ gp.mask = tokens[2 ].toULongLong (nullptr , 16 );
989
+ gp.startBit = tokens[3 ].toInt ();
990
+ if (gp.startBit < 0 ) {
991
+ gp.intelFormat = false ;
992
+ gp.startBit *= -1 ;
993
+ }
994
+ else gp.intelFormat = true ;
995
+ gp.numBits = tokens[4 ].toInt ();
996
+ if (tokens[5 ] == " Y" ) gp.isSigned = true ;
997
+ else gp.isSigned = false ;
998
+ gp.bias = tokens[6 ].toFloat ();
999
+ gp.scale = tokens[7 ].toFloat ();
1000
+ gp.stride = tokens[8 ].toInt ();
1001
+ gp.bus = tokens[9 ].toInt ();
1002
+
1003
+ gp.lineColor .setRed ( tokens[10 ].toInt () );
1004
+ gp.lineColor .setGreen ( tokens[11 ].toInt () );
1005
+ gp.lineColor .setBlue ( tokens[12 ].toInt () );
1006
+ if (tokens.length () > 13 )
1007
+ gp.graphName = tokens[13 ];
1008
+ else
1009
+ gp.graphName = QString ();
1010
+ if (tokens.length () > 20 ) // even newer format with extra graph formatting options
1011
+ {
1012
+ gp.fillColor .setRed ( tokens[14 ].toInt () );
1013
+ gp.fillColor .setGreen ( tokens[15 ].toInt () );
1014
+ gp.fillColor .setBlue ( tokens[16 ].toInt () );
1015
+ gp.fillColor .setAlpha ( tokens[17 ].toInt () );
1016
+ if (tokens[18 ] == " Y" ) gp.drawOnlyPoints = true ;
1017
+ else gp.drawOnlyPoints = false ;
1018
+ gp.pointType = tokens[19 ].toInt ();
1019
+ gp.lineWidth = tokens[20 ].toInt ();
1020
+ }
1021
+ if (tokens.length () > 22 )
1022
+ {
1023
+ DBC_MESSAGE *msg = dbcHandler->findMessage (QString (tokens[21 ]));
1024
+ if (msg)
1025
+ {
1026
+ gp.associatedSignal = msg->sigHandler ->findSignalByName (tokens[22 ]);
1027
+ }
1028
+ else qDebug () << " Couldn't find the message by name! " << tokens[21 ] << " " << tokens[22 ];
1029
+ }
1030
+
1031
+ createGraph (gp, true );
1032
+ }
1033
+ else if (tokens[0 ] == " X" ) // second newest format based around signals
982
1034
{
983
1035
gp.ID = tokens[1 ].toUInt (nullptr , 16 );
984
1036
gp.mask = tokens[2 ].toULongLong (nullptr , 16 );
@@ -1271,7 +1323,7 @@ void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam)
1271
1323
for (int i = 0 ; i < modelFrames->count (); i++)
1272
1324
{
1273
1325
CANFrame thisFrame = modelFrames->at (i);
1274
- if (thisFrame.frameId () == params.ID && thisFrame.frameType () == QCanBusFrame::DataFrame) frameCache.append (thisFrame);
1326
+ if (thisFrame.frameId () == params.ID && thisFrame.frameType () == QCanBusFrame::DataFrame && ( ( params. bus == - 1 ) || (params. bus == thisFrame. bus ) ) ) frameCache.append (thisFrame);
1275
1327
}
1276
1328
1277
1329
// to fix weirdness where a graph that has no data won't be able to be edited, selected, or deleted properly
@@ -1508,6 +1560,7 @@ GraphParams::GraphParams()
1508
1560
scale = 1 ;
1509
1561
stride = 1 ;
1510
1562
strideSoFar = 1 ;
1563
+ bus = -1 ;
1511
1564
lineColor = QColor (0 ,0 ,0 );
1512
1565
fillColor = QColor (255 ,255 ,255 ,0 );
1513
1566
lineWidth = 1 ;
0 commit comments