Skip to content

Commit

Permalink
AP_RCProtocol: do not detect async protocols if not enabled
Browse files Browse the repository at this point in the history
Co-authored-by: olliw42 <[email protected]>
  • Loading branch information
peterbarker and olliw42 committed Mar 7, 2024
1 parent 11127e8 commit dc76268
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion libraries/AP_RCProtocol/AP_RCProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit dc76268

Please sign in to comment.