Skip to content

Commit

Permalink
IO RSSI handling: Make 0-RSSI value consistent for all input sources
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzMeier committed Apr 21, 2015
1 parent 0279193 commit 4440c63
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/modules/px4iofirmware/controls.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@ controls_tick() {
}
#endif

/* zero RSSI if signal is lost */
if (!(r_raw_rc_flags & (PX4IO_P_RAW_RC_FLAGS_RC_OK))) {
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);
Expand Down Expand Up @@ -227,19 +232,17 @@ controls_tick() {
r_raw_rc_flags &= ~(PX4IO_P_RAW_RC_FLAGS_FRAME_DROP);
}

/* set RSSI to an emulated value if ADC RSSI is off */
if (!(r_setup_features & PX4IO_P_SETUP_FEATURES_ADC_RSSI)) {
rssi = sbus_rssi;
}

if (sbus_failsafe) {
r_raw_rc_flags |= PX4IO_P_RAW_RC_FLAGS_FAILSAFE;
/* set RSSI to 0 if the decoder senses complete drop, independent of the ADC value */
rssi = 0;
} else {
r_raw_rc_flags &= ~(PX4IO_P_RAW_RC_FLAGS_FAILSAFE);
}

/* set RSSI to an emulated value if ADC RSSI is off */
if (!(r_setup_features & PX4IO_P_SETUP_FEATURES_ADC_RSSI)) {
rssi = sbus_rssi;
}

}

perf_end(c_gather_sbus);
Expand Down

0 comments on commit 4440c63

Please sign in to comment.