Transmit BQ CRC big-endian

This commit is contained in:
jazzpi 2022-06-23 12:07:18 +02:00
parent 705b9da821
commit d54635c17e
1 changed files with 3 additions and 4 deletions

View File

@ -53,10 +53,9 @@ uint16_t Calculate_CRC(uint8_t* message_buffer, uint16_t bufferlength) {
wCRC = crc16_table[wCRC & 0x00FF] ^ (wCRC >> 8);
}
message_buffer[bufferlength - 1] =
(wCRC >> 8) & 0xFF; // Upper CRC Byte is LSB of CRC
message_buffer[bufferlength - 2] = (wCRC)&0xFF; // Lower CRC Byte is MSB of
// CRC
// CRC is transmitted big-endian in the last two bytes of the message
message_buffer[bufferlength - 2] = wCRC & 0xFF;
message_buffer[bufferlength - 1] = (wCRC >> 8) & 0xFF;
return 1;
}