mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-22 15:55:48 +03:00
Backport rssi inversion from #2540
This commit is contained in:
parent
6aee42dad2
commit
839df10e8c
4 changed files with 12 additions and 5 deletions
|
@ -502,7 +502,7 @@ const clivalue_t valueTable[] = {
|
|||
{ "rc_interp", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &rxConfig()->rcInterpolation, .config.lookup = { TABLE_RC_INTERPOLATION } },
|
||||
{ "rc_interp_ch", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &rxConfig()->rcInterpolationChannels, .config.lookup = { TABLE_RC_INTERPOLATION_CHANNELS } },
|
||||
{ "rc_interp_int", VAR_UINT8 | MASTER_VALUE, &rxConfig()->rcInterpolationInterval, .config.minmax = { 1, 50 } },
|
||||
{ "rssi_ppm_invert", VAR_INT8 | MASTER_VALUE | MODE_LOOKUP, &rxConfig()->rssi_ppm_invert, .config.lookup = { TABLE_OFF_ON } },
|
||||
{ "rssi_invert", VAR_INT8 | MASTER_VALUE | MODE_LOOKUP, &rxConfig()->rssi_invert, .config.lookup = { TABLE_OFF_ON } },
|
||||
#if defined(USE_PWM)
|
||||
{ "input_filtering_mode", VAR_INT8 | MASTER_VALUE | MODE_LOOKUP, &pwmConfig()->inputFilteringMode, .config.lookup = { TABLE_OFF_ON } },
|
||||
#endif
|
||||
|
|
|
@ -875,7 +875,7 @@ void createDefaultConfig(master_t *config)
|
|||
|
||||
config->rxConfig.rssi_channel = 0;
|
||||
config->rxConfig.rssi_scale = RSSI_SCALE_DEFAULT;
|
||||
config->rxConfig.rssi_ppm_invert = 0;
|
||||
config->rxConfig.rssi_invert = 0;
|
||||
config->rxConfig.rcInterpolation = RC_SMOOTHING_AUTO;
|
||||
config->rxConfig.rcInterpolationChannels = 0;
|
||||
config->rxConfig.rcInterpolationInterval = 19;
|
||||
|
|
|
@ -551,7 +551,7 @@ static void updateRSSIPWM(void)
|
|||
pwmRssi = rcData[rxConfig->rssi_channel - 1];
|
||||
|
||||
// RSSI_Invert option
|
||||
if (rxConfig->rssi_ppm_invert) {
|
||||
if (rxConfig->rssi_invert) {
|
||||
pwmRssi = ((2000 - pwmRssi) + 1000);
|
||||
}
|
||||
|
||||
|
@ -592,7 +592,14 @@ static void updateRSSIADC(timeUs_t currentTimeUs)
|
|||
|
||||
adcRssiMean = adcRssiMean / RSSI_ADC_SAMPLE_COUNT;
|
||||
|
||||
rssi = (uint16_t)((constrain(adcRssiMean, 0, 100) / 100.0f) * 1023.0f);
|
||||
adcRssiMean=constrain(adcRssiMean, 0, 100);
|
||||
|
||||
// RSSI_Invert option
|
||||
if (rxConfig->rssi_invert) {
|
||||
adcRssiMean = 100 - adcRssiMean;
|
||||
}
|
||||
|
||||
rssi = (uint16_t)((adcRssiMean / 100.0f) * 1023.0f);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ typedef struct rxConfig_s {
|
|||
uint8_t spektrum_sat_bind_autoreset; // whenever we will reset (exit) binding mode after hard reboot
|
||||
uint8_t rssi_channel;
|
||||
uint8_t rssi_scale;
|
||||
uint8_t rssi_ppm_invert;
|
||||
uint8_t rssi_invert;
|
||||
uint16_t midrc; // Some radios have not a neutral point centered on 1500. can be changed here
|
||||
uint16_t mincheck; // minimum rc end
|
||||
uint16_t maxcheck; // maximum rc end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue