LIN: C API protected ID automatic calculation

pull/56/head
Kyle Johannes 2023-06-22 18:17:00 +00:00
parent a36d114e1f
commit 5b3e21fa7c
1 changed files with 5 additions and 0 deletions

View File

@ -200,6 +200,11 @@ static bool SpyMessageToNeoMessage(const icsSpyMessage& oldmsg, neomessage_frame
linFrame.linStatus.txResponder = true; linFrame.linStatus.txResponder = true;
copyFrameDataPtr(); copyFrameDataPtr();
uint8_t protID = linFrame.header[0] & 0x3Fu;
auto bit = [&](uint8_t pos)->uint8_t { return ((protID >> pos) & 0x1u); };
protID |= (~(bit(1) ^ bit(3) ^ bit(4) ^ bit(5)) << 7);
protID |= ((bit(0) ^ bit(1) ^ bit(2) ^ bit(4)) << 6);
linFrame.header[0] = protID;
if (frame.length > 2) { if (frame.length > 2) {
size_t checksum = 0; size_t checksum = 0;
uint8_t* lastByte = nullptr; uint8_t* lastByte = nullptr;