Fixed priority of RSSI validation: ADC / RX channel / frame errors. (#5703)

This commit is contained in:
Michael Keller 2018-04-19 21:06:21 +12:00 committed by GitHub
parent 864dba98c1
commit 0fd6d5d74e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 17 deletions

View File

@ -254,28 +254,25 @@ static void validateAndFixConfig(void)
} }
#endif // USE_SOFTSPI #endif // USE_SOFTSPI
#if defined(USE_ADC)
if (feature(FEATURE_RSSI_ADC)) {
rxConfigMutable()->rssi_channel = 0;
rxConfigMutable()->rssi_src_frame_errors = false;
} else
#endif
if (rxConfigMutable()->rssi_channel
#if defined(USE_PWM) || defined(USE_PPM)
|| feature(FEATURE_RX_PPM) || feature(FEATURE_RX_PARALLEL_PWM)
#endif
) {
rxConfigMutable()->rssi_src_frame_errors = false;
}
#endif // USE_OSD_SLAVE #endif // USE_OSD_SLAVE
if (!isSerialConfigValid(serialConfig())) { if (!isSerialConfigValid(serialConfig())) {
pgResetFn_serialConfig(serialConfigMutable()); pgResetFn_serialConfig(serialConfigMutable());
} }
#if !defined(USE_OSD_SLAVE)
#if defined(USE_PWM) || defined(USE_PPM)
if (feature(FEATURE_RX_PPM) || feature(FEATURE_RX_PARALLEL_PWM)) {
rxConfigMutable()->rssi_src_frame_errors = false;
} else
#endif
if (rxConfig()->rssi_src_frame_errors) {
featureClear(FEATURE_RSSI_ADC);
rxConfigMutable()->rssi_channel = 0;
#if defined(USE_ADC)
} else if (feature(FEATURE_RSSI_ADC)) {
rxConfigMutable()->rssi_channel = 0;
#endif
}
#endif // USE_OSD_SLAVE
#if defined(USE_ESC_SENSOR) #if defined(USE_ESC_SENSOR)
if (!findSerialPortConfig(FUNCTION_ESC_SENSOR)) { if (!findSerialPortConfig(FUNCTION_ESC_SENSOR)) {
featureClear(FEATURE_ESC_SENSOR); featureClear(FEATURE_ESC_SENSOR);

View File

@ -141,7 +141,7 @@ void pgResetFn_rxConfig(rxConfig_t *rxConfig)
.maxcheck = 1900, .maxcheck = 1900,
.rx_min_usec = RX_MIN_USEC, // any of first 4 channels below this value will trigger rx loss detection .rx_min_usec = RX_MIN_USEC, // any of first 4 channels below this value will trigger rx loss detection
.rx_max_usec = RX_MAX_USEC, // any of first 4 channels above this value will trigger rx loss detection .rx_max_usec = RX_MAX_USEC, // any of first 4 channels above this value will trigger rx loss detection
.rssi_src_frame_errors = true, .rssi_src_frame_errors = false,
.rssi_channel = 0, .rssi_channel = 0,
.rssi_scale = RSSI_SCALE_DEFAULT, .rssi_scale = RSSI_SCALE_DEFAULT,
.rssi_invert = 0, .rssi_invert = 0,