From 594e937e44314fd4c47f17cee4e04ece7dc27048 Mon Sep 17 00:00:00 2001 From: Risto Date: Mon, 5 Apr 2021 18:13:21 +0200 Subject: [PATCH] Making better use of BLUETOOTH_PACKET_SIZE Using BLUETOOTH_PACKET_SIZE instead of literal in code. --- radio/src/bluetooth.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/radio/src/bluetooth.cpp b/radio/src/bluetooth.cpp index efb33334e..26397fc4c 100644 --- a/radio/src/bluetooth.cpp +++ b/radio/src/bluetooth.cpp @@ -215,10 +215,10 @@ void Bluetooth::processTrainerByte(uint8_t data) if (bufferIndex >= BLUETOOTH_PACKET_SIZE) { uint8_t crc = 0x00; - for (int i=0; i<13; i++) { + for (int i=0; i<(BLUETOOTH_PACKET_SIZE-1); i++) { crc ^= buffer[i]; } - if (crc == buffer[13]) { + if (crc == buffer[BLUETOOTH_PACKET_SIZE-1]) { if (buffer[0] == 0x80) { processTrainerFrame(buffer); }