From 32688fc7df7af0067a854155b54179c8455bdaff Mon Sep 17 00:00:00 2001 From: croghostrider Date: Tue, 10 Oct 2017 22:02:31 +0200 Subject: [PATCH] HOTT telemetry fix Pull Request with the changes from @IvaAlex --- src/main/telemetry/hott.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/src/main/telemetry/hott.c b/src/main/telemetry/hott.c index a956aebfcb..89882cbe31 100644 --- a/src/main/telemetry/hott.c +++ b/src/main/telemetry/hott.c @@ -346,6 +346,8 @@ static void hottConfigurePortForTX(void) } else { serialSetMode(hottPort, MODE_TX); } + hottIsSending = true; + hottMsgCrc = 0; } static void hottConfigurePortForRX(void) @@ -356,26 +358,11 @@ static void hottConfigurePortForRX(void) } else { serialSetMode(hottPort, MODE_RX); } + hottMsg = NULL; + hottIsSending = false; flushHottRxBuffer(); } -static void hottReconfigurePort(void) -{ - if (!hottIsSending) { - hottIsSending = true; - hottMsgCrc = 0; - hottConfigurePortForTX(); - return; - } - - if (hottMsgRemainingBytesToSendCount == 0) { - hottMsg = NULL; - hottIsSending = false; - hottConfigurePortForRX(); - return; - } -} - void configureHoTTTelemetryPort(void) { if (!portConfig) { @@ -510,7 +497,15 @@ static void hottCheckSerialData(uint32_t currentMicros) static void hottSendTelemetryData(void) { - hottReconfigurePort(); + if (!hottIsSending) { + hottConfigurePortForTX(); + return; + } + + if (hottMsgRemainingBytesToSendCount == 0) { + hottConfigurePortForRX(); + return; + } --hottMsgRemainingBytesToSendCount; if (hottMsgRemainingBytesToSendCount == 0) {