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:
Daniel Agar
2020-08-02 12:52:16 -04:00
committed by GitHub
parent 1191a0efe6
commit 63a23957b1
7 changed files with 168 additions and 64 deletions
+7
View File
@@ -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;
+2
View File
@@ -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(