st24: fix RC lost detection based on error count

The packet_count was actually an error_count, therefore we should
process RC input only when the error_count since the last packet is 0.

Also, this commit fixes the RSSI scaling for st24.
This commit is contained in:
Julian Oes
2016-10-19 09:22:57 +02:00
committed by Lorenz Meier
parent ffaed18e67
commit af5d2c488c
4 changed files with 20 additions and 16 deletions
+3 -3
View File
@@ -96,7 +96,7 @@ bool dsm_port_input(uint16_t *rssi, bool *dsm_updated, bool *st24_updated, bool
perf_end(c_gather_dsm);
/* get data from FD and attempt to parse with DSM and ST24 libs */
uint8_t st24_rssi, rx_count;
uint8_t st24_rssi, lost_count;
uint16_t st24_channel_count = 0;
*st24_updated = false;
@@ -104,11 +104,11 @@ bool dsm_port_input(uint16_t *rssi, bool *dsm_updated, bool *st24_updated, bool
for (unsigned i = 0; i < n_bytes; i++) {
/* set updated flag if one complete packet was parsed */
st24_rssi = RC_INPUT_RSSI_MAX;
*st24_updated |= (OK == st24_decode(bytes[i], &st24_rssi, &rx_count,
*st24_updated |= (OK == st24_decode(bytes[i], &st24_rssi, &lost_count,
&st24_channel_count, r_raw_rc_values, PX4IO_RC_INPUT_CHANNELS));
}
if (*st24_updated) {
if (*st24_updated && lost_count == 0) {
/* ensure ADC RSSI is disabled */
r_setup_features &= ~(PX4IO_P_SETUP_FEATURES_ADC_RSSI);