mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 21:33:34 +08:00
rc/dsm: decode improvements
- always check system field for validity - reject any data outside of "servo position" valid range from Spektrum specification - properly support XPlus channels (12+) - debug message if channel count changes
This commit is contained in:
@@ -320,6 +320,13 @@ RCUpdate::Run()
|
||||
|
||||
if (_input_rc_sub.copy(&rc_input)) {
|
||||
|
||||
// warn if the channel count is changing (possibly indication of error)
|
||||
if (!rc_input.rc_lost && (_channel_count_previous != rc_input.channel_count) && (_channel_count_previous > 0)) {
|
||||
PX4_DEBUG("RC channel count changed %d -> %d", _channel_count_previous, rc_input.channel_count);
|
||||
}
|
||||
|
||||
_channel_count_previous = rc_input.channel_count;
|
||||
|
||||
/* detect RC signal loss */
|
||||
bool signal_lost = true;
|
||||
|
||||
|
||||
@@ -166,6 +166,8 @@ private:
|
||||
|
||||
hrt_abstime _last_rc_to_param_map_time = 0;
|
||||
|
||||
uint8_t _channel_count_previous{0};
|
||||
|
||||
perf_counter_t _loop_perf; /**< loop performance counter */
|
||||
|
||||
DEFINE_PARAMETERS(
|
||||
|
||||
Reference in New Issue
Block a user