1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-26 01:35:41 +03:00

Add RSSI PWM on CH2 input.

Also support FrSky 1khz RSSI.  See documentation also added in this
commit.

This commit also cleans up the PWM mapping code.  'mask' didn't need to
be a mask and it wasn't possible to add another 'type' since there were
only 4 possible values when it was a mask and they were already defined.  
Combined with switching to using 16 bits instead of 8 for the mapping
configurations, it's now possible to have 256 types instead of 4 at the
expense of a few bytes of flash.

Moved the RSSI calculation into rx_common.c, previously it was in the
main loop.
This commit is contained in:
Dominic Clifton 2014-05-23 23:57:32 +01:00
parent 1b80c76e30
commit 1925df26ca
14 changed files with 312 additions and 92 deletions

View file

@ -64,8 +64,6 @@ int16_t headFreeModeHold;
int16_t telemTemperature1; // gyro sensor temperature
uint16_t rssi; // range: [0;1023]
extern uint8_t dynP8[3], dynI8[3], dynD8[3];
extern failsafe_t *failsafe;
@ -302,12 +300,7 @@ void loop(void)
mwDisarm();
}
// Read value of AUX channel as rssi
if (masterConfig.rxConfig.rssi_channel > 0) {
const int16_t rssiChannelData = rcData[masterConfig.rxConfig.rssi_channel - 1];
// Range of rssiChannelData is [1000;2000]. rssi should be in [0;1023];
rssi = (uint16_t)((constrain(rssiChannelData - 1000, 0, 1000) / 1000.0f) * 1023.0f);
}
updateRSSI();
if (feature(FEATURE_FAILSAFE)) {