diff --git a/radio/src/bluetooth.cpp b/radio/src/bluetooth.cpp index be35693c7..11576c9be 100644 --- a/radio/src/bluetooth.cpp +++ b/radio/src/bluetooth.cpp @@ -217,11 +217,11 @@ 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 (buffer[0] == 0x80) { + if (crc == buffer[BLUETOOTH_PACKET_SIZE-1]) { + if (buffer[0] == TRAINER_FRAME) { processTrainerFrame(buffer); } } @@ -251,7 +251,7 @@ void Bluetooth::sendTrainer() crc = 0x00; buffer[bufferIndex++] = START_STOP; // start byte - pushByte(0x80); // trainer frame type? + pushByte(TRAINER_FRAME); for (int channel=0; channel