From bb1a7623aa1171faf4cb1e46ad3f3b57b559a62b Mon Sep 17 00:00:00 2001 From: Pacerino Date: Fri, 28 Apr 2023 15:36:57 +0200 Subject: [PATCH] Add Extended CAN Bus Frame to SLCAN/LAWICEL --- connections/lawicel_serial.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/connections/lawicel_serial.cpp b/connections/lawicel_serial.cpp index b312bf7..7377151 100644 --- a/connections/lawicel_serial.cpp +++ b/connections/lawicel_serial.cpp @@ -475,6 +475,32 @@ void LAWICELSerial::readSerialData() } break; case 'T': //extended frame + //TIIIIIIIILDD. + buildFrame.setFrameId(mBuildLine.mid(1, 8).toInt(nullptr, 16)); + buildFrame.isReceived = true; + buildFrame.setFrameType(QCanBusFrame::FrameType::DataFrame); + buildFrame.setExtendedFrameFormat(true); + buildData.resize(mBuildLine.mid(9, 1).toInt()); + for (int c = 0; c < buildData.size(); c++) + { + buildData[c] = mBuildLine.mid(10 + (c*2), 2).toInt(nullptr, 16); + } + buildFrame.setPayload(buildData); + if (!isCapSuspended()) + { + /* get frame from queue */ + CANFrame* frame_p = getQueue().get(); + if(frame_p) { + //qDebug() << "Lawicel got frame on bus " << frame_p->bus; + /* copy frame */ + *frame_p = buildFrame; + checkTargettedFrame(buildFrame); + /* enqueue frame */ + getQueue().queue(); + } + else + qDebug() << "can't get a frame, ERROR"; + } break; } mBuildLine.clear();