diff --git a/docs/Cli.md b/docs/Cli.md index 05ab6c828c..fe0116f6ee 100644 --- a/docs/Cli.md +++ b/docs/Cli.md @@ -107,6 +107,7 @@ Re-apply any new defaults as desired. | max_check | These are min/max values (in us) which, when a channel is smaller (min) or larger (max) than the value will activate various RC commands, such as arming, or stick configuration. Normally, every RC channel should be set so that min = 1000us, max = 2000us. On most transmitters this usually means 125% endpoints. Default check values are 100us above/below this value. | 0 | 2000 | 1900 | Master | UINT16 | | rssi_channel | | 0 | 18 | 0 | Master | INT8 | | rssi_scale | | 1 | 255 | 30 | Master | UINT8 | +| rssi_ppm_invert | | 0 | 1 | 0 | Master | UINT8 | | input_filtering_mode | | 0 | 1 | 0 | Master | INT8 | | min_throttle | These are min/max values (in us) that are sent to esc when armed. Defaults of 1150/1850 are OK for everyone, for use with AfroESC, they could be set to 1064/1864. | 0 | 2000 | 1150 | Master | UINT16 | | max_throttle | These are min/max values (in us) that are sent to esc when armed. Defaults of 1150/1850 are OK for everyone, for use with AfroESC, they could be set to 1064/1864. | 0 | 2000 | 1850 | Master | UINT16 | diff --git a/docs/Rssi.md b/docs/Rssi.md index d10002d459..63a50f6330 100644 --- a/docs/Rssi.md +++ b/docs/Rssi.md @@ -17,6 +17,12 @@ e.g. if you used channel 9 then you would set: ``` set rssi_channel = 9 ``` +Note: Some systems such as EZUHF invert the RSSI ( 0 = Full signal / 100 = Lost signal). To correct this problem you can invert the channel input so you will get a correct reading by using command: + +``` +set rssi_ppm_invert = 1 +``` +Default is set to "0" for normal operation ( 100 = Full signal / 0 = Lost signal). ## RSSI via Parallel PWM channel diff --git a/src/main/config/config.c b/src/main/config/config.c index 1f05817690..3e9140bb43 100644 --- a/src/main/config/config.c +++ b/src/main/config/config.c @@ -138,7 +138,7 @@ profile_t *currentProfile; static uint8_t currentControlRateProfileIndex = 0; controlRateConfig_t *currentControlRateProfile; -static const uint8_t EEPROM_CONF_VERSION = 98; +static const uint8_t EEPROM_CONF_VERSION = 99; static void resetAccelerometerTrims(flightDynamicsTrims_t *accelerometerTrims) { @@ -416,6 +416,7 @@ static void resetConf(void) masterConfig.rxConfig.rssi_channel = 0; masterConfig.rxConfig.rssi_scale = RSSI_SCALE_DEFAULT; + masterConfig.rxConfig.rssi_ppm_invert = 0; masterConfig.inputFilteringMode = INPUT_FILTERING_DISABLED; diff --git a/src/main/io/serial_cli.c b/src/main/io/serial_cli.c index f4497417f1..7e36d4a23e 100644 --- a/src/main/io/serial_cli.c +++ b/src/main/io/serial_cli.c @@ -259,6 +259,7 @@ const clivalue_t valueTable[] = { { "max_check", VAR_UINT16 | MASTER_VALUE, &masterConfig.rxConfig.maxcheck, PWM_RANGE_ZERO, PWM_RANGE_MAX }, { "rssi_channel", VAR_INT8 | MASTER_VALUE, &masterConfig.rxConfig.rssi_channel, 0, MAX_SUPPORTED_RC_CHANNEL_COUNT }, { "rssi_scale", VAR_UINT8 | MASTER_VALUE, &masterConfig.rxConfig.rssi_scale, RSSI_SCALE_MIN, RSSI_SCALE_MAX }, + { "rssi_ppm_invert", VAR_INT8 | MASTER_VALUE, &masterConfig.rxConfig.rssi_ppm_invert, 0, 1 }, { "input_filtering_mode", VAR_INT8 | MASTER_VALUE, &masterConfig.inputFilteringMode, 0, 1 }, { "min_throttle", VAR_UINT16 | MASTER_VALUE, &masterConfig.escAndServoConfig.minthrottle, PWM_RANGE_ZERO, PWM_RANGE_MAX }, diff --git a/src/main/rx/rx.c b/src/main/rx/rx.c index af0005c55a..16233f5ce4 100644 --- a/src/main/rx/rx.c +++ b/src/main/rx/rx.c @@ -385,8 +385,12 @@ void updateRSSIPWM(void) int16_t pwmRssi = 0; // Read value of AUX channel as rssi pwmRssi = rcData[rxConfig->rssi_channel - 1]; - - + + // RSSI_Invert option + if (rxConfig->rssi_ppm_invert) { + pwmRssi = ((2000 - pwmRssi) + 1000); + } + // Range of rawPwmRssi is [1000;2000]. rssi should be in [0;1023]; rssi = (uint16_t)((constrain(pwmRssi - 1000, 0, 1000) / 1000.0f) * 1023.0f); } diff --git a/src/main/rx/rx.h b/src/main/rx/rx.h index 56389dbcb3..8629cc1532 100644 --- a/src/main/rx/rx.h +++ b/src/main/rx/rx.h @@ -78,6 +78,7 @@ typedef struct rxConfig_s { uint8_t spektrum_sat_bind; // number of bind pulses for Spektrum satellite receivers uint8_t rssi_channel; uint8_t rssi_scale; + uint8_t rssi_ppm_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