mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-02 03:51:35 +08:00
Prevented unhealthy RC input from propagating through the system
This commit is contained in:
@@ -461,15 +461,17 @@ PX4IO::rx_callback(const uint8_t *buffer, size_t bytes_received)
|
|||||||
}
|
}
|
||||||
_connected = true;
|
_connected = true;
|
||||||
|
|
||||||
/* publish raw rc channel values from IO */
|
/* publish raw rc channel values from IO if valid channels are present */
|
||||||
_input_rc.timestamp = hrt_absolute_time();
|
if (rep->channel_count > 0) {
|
||||||
_input_rc.channel_count = rep->channel_count;
|
_input_rc.timestamp = hrt_absolute_time();
|
||||||
for (int i = 0; i < rep->channel_count; i++)
|
_input_rc.channel_count = rep->channel_count;
|
||||||
{
|
for (int i = 0; i < rep->channel_count; i++)
|
||||||
_input_rc.values[i] = rep->rc_channel[i];
|
{
|
||||||
}
|
_input_rc.values[i] = rep->rc_channel[i];
|
||||||
|
}
|
||||||
|
|
||||||
orb_publish(ORB_ID(input_rc), _to_input_rc, &_input_rc);
|
orb_publish(ORB_ID(input_rc), _to_input_rc, &_input_rc);
|
||||||
|
}
|
||||||
|
|
||||||
/* remember the latched arming switch state */
|
/* remember the latched arming switch state */
|
||||||
_switch_armed = rep->armed;
|
_switch_armed = rep->armed;
|
||||||
|
|||||||
+7
-1
@@ -132,7 +132,13 @@ comms_main(void)
|
|||||||
/* populate the report */
|
/* populate the report */
|
||||||
for (int i = 0; i < system_state.rc_channels; i++)
|
for (int i = 0; i < system_state.rc_channels; i++)
|
||||||
report.rc_channel[i] = system_state.rc_channel_data[i];
|
report.rc_channel[i] = system_state.rc_channel_data[i];
|
||||||
report.channel_count = system_state.rc_channels;
|
|
||||||
|
if (system_state.sbus_input_ok || system_state.dsm_input_ok || system_state.ppm_input_ok) {
|
||||||
|
report.channel_count = system_state.rc_channels;
|
||||||
|
} else {
|
||||||
|
report.channel_count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
report.armed = system_state.armed;
|
report.armed = system_state.armed;
|
||||||
|
|
||||||
/* and send it */
|
/* and send it */
|
||||||
|
|||||||
Reference in New Issue
Block a user