From 98a9826bdf7cf44472a4ee172035bacd987e69e9 Mon Sep 17 00:00:00 2001 From: DaTwo Date: Sat, 25 Apr 2015 15:18:11 -0700 Subject: [PATCH 1/7] Update rx.c --- src/main/rx/rx.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/rx/rx.c b/src/main/rx/rx.c index af0005c55a..b45506177f 100644 --- a/src/main/rx/rx.c +++ b/src/main/rx/rx.c @@ -385,10 +385,21 @@ 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) { + if (pwmRssi < 1000) { + pwmRssi = 1000; + } + if (pwmRssi > 2000) { + pwmRssi = 2000; + } + + 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); + rssi = (uint16_t)((constrain(pwmRssi - 1000, 0, 1000) / 1000.0f) * 1023.0f); } #define RSSI_ADC_SAMPLE_COUNT 16 From 278a682f987a84a01986e160ee1fba08bc204553 Mon Sep 17 00:00:00 2001 From: DaTwo Date: Sat, 25 Apr 2015 15:21:11 -0700 Subject: [PATCH 2/7] Update rx.h --- src/main/rx/rx.h | 1 + 1 file changed, 1 insertion(+) 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 From ade7887f7a263d669fcdebf14122389ef8101def Mon Sep 17 00:00:00 2001 From: DaTwo Date: Sat, 25 Apr 2015 15:24:28 -0700 Subject: [PATCH 3/7] Update serial_cli.c --- src/main/io/serial_cli.c | 1 + 1 file changed, 1 insertion(+) 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 }, From ce3b5c0984138962a1868c9fd85b60c70eb0bbc2 Mon Sep 17 00:00:00 2001 From: DaTwo Date: Sat, 25 Apr 2015 15:27:26 -0700 Subject: [PATCH 4/7] Update config.c --- src/main/config/config.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; From 862169807f99a20ced17ac5c10a31024715fec1f Mon Sep 17 00:00:00 2001 From: DaTwo Date: Tue, 5 May 2015 08:09:16 -0700 Subject: [PATCH 5/7] Update Cli.md Updated CLI command in docs. --- docs/Cli.md | 1 + 1 file changed, 1 insertion(+) 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 | From 38308020a1e45d770f81b6a8e9f4038e1b4653f2 Mon Sep 17 00:00:00 2001 From: DaTwo Date: Thu, 7 May 2015 02:50:27 -0700 Subject: [PATCH 6/7] Update rx.c --- src/main/rx/rx.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/main/rx/rx.c b/src/main/rx/rx.c index b45506177f..16233f5ce4 100644 --- a/src/main/rx/rx.c +++ b/src/main/rx/rx.c @@ -388,18 +388,11 @@ void updateRSSIPWM(void) // RSSI_Invert option if (rxConfig->rssi_ppm_invert) { - if (pwmRssi < 1000) { - pwmRssi = 1000; - } - if (pwmRssi > 2000) { - pwmRssi = 2000; - } - - pwmRssi = ((2000 - pwmRssi) + 1000); + 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); + rssi = (uint16_t)((constrain(pwmRssi - 1000, 0, 1000) / 1000.0f) * 1023.0f); } #define RSSI_ADC_SAMPLE_COUNT 16 From 7530fe0f4abb4ac027461a15f214ffc091e1961a Mon Sep 17 00:00:00 2001 From: DaTwo Date: Thu, 7 May 2015 07:11:09 -0700 Subject: [PATCH 7/7] Update Rssi.md --- docs/Rssi.md | 6 ++++++ 1 file changed, 6 insertions(+) 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