Merge pull request #816 from DaTwo/RSSI-Invert-Patch

Inverted RSSI PPM / PWM (EZUHF) CLI Option
This commit is contained in:
Dominic Clifton 2015-05-14 19:20:28 +01:00
commit 77217f23a7
6 changed files with 17 additions and 3 deletions

View File

@ -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 |

View File

@ -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

View File

@ -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;

View File

@ -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 },

View File

@ -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);
}

View File

@ -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