fix: Trainer jack initialisation and driver cleanup (#3811)

This commit is contained in:
3djc
2023-08-09 21:08:42 +10:00
committed by GitHub
parent f7037a92b0
commit ae8e1fff8a
16 changed files with 57 additions and 48 deletions
+3 -3
View File
@@ -141,11 +141,11 @@ void Bluetooth::processTrainerFrame(const uint8_t * buffer)
{
for (uint8_t channel=0, i=1; channel<BLUETOOTH_TRAINER_CHANNELS; channel+=2, i+=3) {
// +-500 != 512, but close enough.
ppmInput[channel] = buffer[i] + ((buffer[i+1] & 0xf0) << 4) - 1500;
ppmInput[channel+1] = ((buffer[i+1] & 0x0f) << 4) + ((buffer[i+2] & 0xf0) >> 4) + ((buffer[i+2] & 0x0f) << 8) - 1500;
trainerInput[channel] = buffer[i] + ((buffer[i+1] & 0xf0) << 4) - 1500;
trainerInput[channel+1] = ((buffer[i+1] & 0x0f) << 4) + ((buffer[i+2] & 0xf0) >> 4) + ((buffer[i+2] & 0x0f) << 8) - 1500;
}
ppmInputValidityTimer = PPM_IN_VALID_TIMEOUT;
trainerInputValidityTimer = TRAINER_IN_VALID_TIMEOUT;
}
void Bluetooth::appendTrainerByte(uint8_t data)