added ability to assign one of aux1..4 channels as RSSI by the-kenny
git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@416 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
parent
91d64fc6c1
commit
01eaf85510
|
@ -147,6 +147,7 @@ const clivalue_t valueTable[] = {
|
|||
{ "failsafe_off_delay", VAR_UINT8, &cfg.failsafe_off_delay, 0, 200 },
|
||||
{ "failsafe_throttle", VAR_UINT16, &cfg.failsafe_throttle, 1000, 2000 },
|
||||
{ "failsafe_detect_threshold", VAR_UINT16, &cfg.failsafe_detect_threshold, 100, 2000 },
|
||||
{ "rssi_aux_channel", VAR_INT8, &mcfg.rssi_aux_channel, 0, 4 },
|
||||
{ "yaw_direction", VAR_INT8, &cfg.yaw_direction, -1, 1 },
|
||||
{ "tri_unarmed_servo", VAR_INT8, &cfg.tri_unarmed_servo, 0, 1 },
|
||||
{ "tri_yaw_middle", VAR_UINT16, &cfg.tri_yaw_middle, 0, 2000 },
|
||||
|
|
|
@ -209,6 +209,7 @@ static void resetConf(void)
|
|||
// serial (USART1) baudrate
|
||||
mcfg.serial_baudrate = 115200;
|
||||
mcfg.looptime = 3500;
|
||||
mcfg.rssi_aux_channel = 0;
|
||||
|
||||
cfg.pidController = 0;
|
||||
cfg.P8[ROLL] = 40;
|
||||
|
|
8
src/mw.c
8
src/mw.c
|
@ -452,6 +452,14 @@ void loop(void)
|
|||
mwDisarm();
|
||||
}
|
||||
|
||||
// Read value of AUX channel as rssi
|
||||
// 0 is disable, 1-4 is AUX{1..4}
|
||||
if (mcfg.rssi_aux_channel > 0) {
|
||||
const int16_t rssiChannelData = rcData[AUX1 + mcfg.rssi_aux_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);
|
||||
}
|
||||
|
||||
// Failsafe routine
|
||||
if (feature(FEATURE_FAILSAFE)) {
|
||||
if (failsafeCnt > (5 * cfg.failsafe_delay) && f.ARMED) { // Stabilize, and set Throttle to specified level
|
||||
|
|
3
src/mw.h
3
src/mw.h
|
@ -279,10 +279,11 @@ typedef struct master_t {
|
|||
uint16_t maxcheck; // maximum rc end
|
||||
uint8_t retarded_arm; // allow disarsm/arm on throttle down + roll left/right
|
||||
|
||||
uint8_t rssi_aux_channel; // Read rssi from channel. 1+ = AUX1+, 0 to disable.
|
||||
|
||||
// gps-related stuff
|
||||
uint8_t gps_type; // Type of GPS hardware. 0: NMEA 1: UBX 2+ ??
|
||||
uint32_t gps_baudrate; // GPS baudrate
|
||||
|
||||
// serial(uart1) baudrate
|
||||
uint32_t serial_baudrate;
|
||||
|
||||
|
|
Loading…
Reference in New Issue