Using new TRAINER_FRAME

This commit is contained in:
Risto
2021-04-05 18:19:20 +02:00
committed by GitHub
parent 2a6cde247d
commit a04b3f377a
+2 -2
View File
@@ -219,7 +219,7 @@ void Bluetooth::processTrainerByte(uint8_t data)
crc ^= buffer[i];
}
if (crc == buffer[BLUETOOTH_PACKET_SIZE-1]) {
if (buffer[0] == 0x80) {
if (buffer[0] == TRAINER_FRAME) {
processTrainerFrame(buffer);
}
}
@@ -249,7 +249,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<lastCh; channel+=2, cur+=3) {
uint16_t channelValue1 = PPM_CH_CENTER(channel) + limit((int16_t)-PPM_range, channelOutputs[channel], (int16_t)PPM_range) / 2;
uint16_t channelValue2 = PPM_CH_CENTER(channel+1) + limit((int16_t)-PPM_range, channelOutputs[channel+1], (int16_t)PPM_range) / 2;