mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-22 10:17:34 +08:00
PX4IO Firmware: Only decode DSM if no other input method matched
This ensures that the DSM decoder does not accidentally decode noise on the bus as DSM is not well-protected against CRC errors.
This commit is contained in:
@@ -230,24 +230,6 @@ controls_tick()
|
||||
rssi = 0;
|
||||
}
|
||||
|
||||
perf_begin(c_gather_dsm);
|
||||
bool dsm_updated, st24_updated, sumd_updated;
|
||||
(void)dsm_port_input(&rssi, &dsm_updated, &st24_updated, &sumd_updated);
|
||||
|
||||
if (dsm_updated) {
|
||||
PX4_ATOMIC_MODIFY_OR(r_status_flags, PX4IO_P_STATUS_FLAGS_RC_DSM);
|
||||
}
|
||||
|
||||
if (st24_updated) {
|
||||
PX4_ATOMIC_MODIFY_OR(r_status_flags, PX4IO_P_STATUS_FLAGS_RC_ST24);
|
||||
}
|
||||
|
||||
if (sumd_updated) {
|
||||
PX4_ATOMIC_MODIFY_OR(r_status_flags, PX4IO_P_STATUS_FLAGS_RC_SUMD);
|
||||
}
|
||||
|
||||
perf_end(c_gather_dsm);
|
||||
|
||||
perf_begin(c_gather_sbus);
|
||||
|
||||
bool sbus_failsafe, sbus_frame_drop;
|
||||
@@ -300,6 +282,26 @@ controls_tick()
|
||||
|
||||
perf_end(c_gather_ppm);
|
||||
|
||||
if (!((r_status_flags & PX4IO_P_STATUS_FLAGS_RC_SBUS) || (r_status_flags & PX4IO_P_STATUS_FLAGS_RC_PPM))) {
|
||||
perf_begin(c_gather_dsm);
|
||||
bool dsm_updated, st24_updated, sumd_updated;
|
||||
(void)dsm_port_input(&rssi, &dsm_updated, &st24_updated, &sumd_updated);
|
||||
|
||||
if (dsm_updated) {
|
||||
PX4_ATOMIC_MODIFY_OR(r_status_flags, PX4IO_P_STATUS_FLAGS_RC_DSM);
|
||||
}
|
||||
|
||||
if (st24_updated) {
|
||||
PX4_ATOMIC_MODIFY_OR(r_status_flags, PX4IO_P_STATUS_FLAGS_RC_ST24);
|
||||
}
|
||||
|
||||
if (sumd_updated) {
|
||||
PX4_ATOMIC_MODIFY_OR(r_status_flags, PX4IO_P_STATUS_FLAGS_RC_SUMD);
|
||||
}
|
||||
|
||||
perf_end(c_gather_dsm);
|
||||
}
|
||||
|
||||
/* limit number of channels to allowable data size */
|
||||
if (r_raw_rc_count > PX4IO_RC_INPUT_CHANNELS) {
|
||||
r_raw_rc_count = PX4IO_RC_INPUT_CHANNELS;
|
||||
|
||||
Reference in New Issue
Block a user