Fixed bug where switching to RAW mode would fail due to the "ok" response being received in the same message as the first data frame
Sometimes when opening socketcand 1 or more busses won't start right and there's a ton of debug data saying "received datagramm: ...." It seems to happen because the switch to RAW mode is in progress and we receive the OK with a frame in the same datagramm and we don't parse the OK out of the string but rather expect the whole string to just be OK. Offending code is in socketcand.cpp SocketCANd::procRXData line 386 Fixed by looking to see if the < ok > message was at index 0 of the incoming message...could also look for it elsewhere (as in index != -1), but not sure if necessary
This commit is contained in:
+1
-1
@@ -779,7 +779,7 @@ int CANFrameModel::sendBulkRefresh()
|
|||||||
if (lastUpdateNumFrames == 0 && !overwriteDups) return 0;
|
if (lastUpdateNumFrames == 0 && !overwriteDups) return 0;
|
||||||
if (filteredFrames.count() == 0) return 0;
|
if (filteredFrames.count() == 0) return 0;
|
||||||
|
|
||||||
qDebug() << "Bulk refresh of " << lastUpdateNumFrames;
|
//qDebug() << "Bulk refresh of " << lastUpdateNumFrames;
|
||||||
|
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
endResetModel();
|
endResetModel();
|
||||||
|
|||||||
@@ -396,6 +396,12 @@ void SocketCANd::procRXData(QString data, int busNum)
|
|||||||
{
|
{
|
||||||
rx_state[busNum] = RAWMODE;
|
rx_state[busNum] = RAWMODE;
|
||||||
}
|
}
|
||||||
|
else if(data.indexOf("< ok >", 0, Qt::CaseSensitivity::CaseInsensitive) == 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Ok found at start of compound message, switching to RAW and decoding immediately";
|
||||||
|
rx_state[busNum] = RAWMODE;
|
||||||
|
decodeFrames(data, busNum);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case RAWMODE:
|
case RAWMODE:
|
||||||
decodeFrames(data, busNum);
|
decodeFrames(data, busNum);
|
||||||
|
|||||||
Reference in New Issue
Block a user