From dc7626887f50374db27177c3ea1158a94bc9f682 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 6 Mar 2024 09:21:59 +1100 Subject: [PATCH] AP_RCProtocol: do not detect async protocols if not enabled Co-authored-by: olliw42 --- libraries/AP_RCProtocol/AP_RCProtocol.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libraries/AP_RCProtocol/AP_RCProtocol.cpp b/libraries/AP_RCProtocol/AP_RCProtocol.cpp index 7e53bda5e7979..0141968f7e2a2 100644 --- a/libraries/AP_RCProtocol/AP_RCProtocol.cpp +++ b/libraries/AP_RCProtocol/AP_RCProtocol.cpp @@ -394,6 +394,14 @@ bool AP_RCProtocol::detect_async_protocol(rcprotocol_t protocol) return false; } +#if AP_RC_CHANNEL_ENABLED + rc_protocols_mask = rc().enabled_protocols(); +#endif + + if (!protocol_enabled(protocol)) { + return false; + } + // nobody is providing data; can we provide data? if (!p->new_input()) { // we can't provide data @@ -582,7 +590,7 @@ void AP_RCProtocol::add_uart(AP_HAL::UARTDriver* uart) // return true if a specific protocol is enabled bool AP_RCProtocol::protocol_enabled(rcprotocol_t protocol) const { - if ((rc_protocols_mask & 1) != 0) { + if ((rc_protocols_mask & 1U) != 0) { // all protocols enabled return true; }