mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 10:33:34 +08:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user