mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-10 18:08:30 -04:00
AP_RCProtocol: check for RC protocol switching enable
by default don't allow protocol switching after initial protocol is found
This commit is contained in:
parent
8c123cc6e5
commit
8ea702ed81
@ -63,10 +63,20 @@ AP_RCProtocol::~AP_RCProtocol()
|
||||
}
|
||||
}
|
||||
|
||||
bool AP_RCProtocol::should_search(uint32_t now_ms) const
|
||||
{
|
||||
#ifndef IOMCU_FW
|
||||
if (_detected_protocol != AP_RCProtocol::NONE && !rc().allow_rc_protocol_switching()) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return (now_ms - _last_input_ms >= 200);
|
||||
}
|
||||
|
||||
void AP_RCProtocol::process_pulse(uint32_t width_s0, uint32_t width_s1)
|
||||
{
|
||||
uint32_t now = AP_HAL::millis();
|
||||
bool searching = (now - _last_input_ms >= 200);
|
||||
bool searching = should_search(now);
|
||||
|
||||
#ifndef IOMCU_FW
|
||||
rc_protocols_mask = rc().enabled_protocols();
|
||||
@ -150,7 +160,7 @@ void AP_RCProtocol::process_pulse_list(const uint32_t *widths, uint16_t n, bool
|
||||
bool AP_RCProtocol::process_byte(uint8_t byte, uint32_t baudrate)
|
||||
{
|
||||
uint32_t now = AP_HAL::millis();
|
||||
bool searching = (now - _last_input_ms >= 200);
|
||||
bool searching = should_search(now);
|
||||
|
||||
#ifndef IOMCU_FW
|
||||
rc_protocols_mask = rc().enabled_protocols();
|
||||
@ -234,7 +244,7 @@ void AP_RCProtocol::check_added_uart(void)
|
||||
return;
|
||||
}
|
||||
uint32_t now = AP_HAL::millis();
|
||||
bool searching = (now - _last_input_ms >= 200);
|
||||
bool searching = should_search(now);
|
||||
if (!searching && !_detected_with_bytes) {
|
||||
// not using this uart
|
||||
return;
|
||||
|
@ -49,6 +49,7 @@ public:
|
||||
{
|
||||
return _valid_serial_prot;
|
||||
}
|
||||
bool should_search(uint32_t now_ms) const;
|
||||
void process_pulse(uint32_t width_s0, uint32_t width_s1);
|
||||
void process_pulse_list(const uint32_t *widths, uint16_t n, bool need_swap);
|
||||
bool process_byte(uint8_t byte, uint32_t baudrate);
|
||||
|
Loading…
Reference in New Issue
Block a user