1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 05:15:25 +03:00

Allow inflight adjustment of throttle expo.

This commit is contained in:
Dominic Clifton 2014-10-24 22:09:06 +01:00
parent f166ca3516
commit 4a90599e3a
3 changed files with 18 additions and 5 deletions

View file

@ -46,6 +46,8 @@
#include "io/rc_controls.h"
#include "io/rc_curves.h"
static escAndServoConfig_t *escAndServoConfig;
static bool isUsingSticksToArm = true;
int16_t rcCommand[4]; // interval [1000;2000] for THROTTLE and [-500;+500] for ROLL/PITCH/YAW
@ -272,6 +274,10 @@ static const adjustmentConfig_t defaultAdjustmentConfigs[ADJUSTMENT_FUNCTION_COU
.adjustmentFunction = ADJUSTMENT_RC_EXPO,
.step = 1
},
{
.adjustmentFunction = ADJUSTMENT_THROTTLE_EXPO,
.step = 1
},
{
.adjustmentFunction = ADJUSTMENT_PITCH_ROLL_RATE,
.step = 1
@ -329,6 +335,11 @@ void applyAdjustment(controlRateConfig_t *controlRateConfig, uint8_t adjustmentF
controlRateConfig->rcExpo8 = constrain(newValue, 0, 100); // FIXME magic numbers repeated in serial_cli.c
generatePitchRollCurve(controlRateConfig);
break;
case ADJUSTMENT_THROTTLE_EXPO:
newValue = (int)controlRateConfig->thrExpo8 + delta;
controlRateConfig->thrExpo8 = constrain(newValue, 0, 100); // FIXME magic numbers repeated in serial_cli.c
generateThrottleCurve(controlRateConfig, escAndServoConfig);
break;
case ADJUSTMENT_PITCH_ROLL_RATE:
newValue = (int)controlRateConfig->rollPitchRate + delta;
controlRateConfig->rollPitchRate = constrain(newValue, 0, 100); // FIXME magic numbers repeated in serial_cli.c
@ -405,10 +416,12 @@ void updateAdjustmentStates(adjustmentRange_t *adjustmentRanges)
}
}
void useRcControlsConfig(modeActivationCondition_t *modeActivationConditions)
void useRcControlsConfig(modeActivationCondition_t *modeActivationConditions, escAndServoConfig_t *escAndServoConfigToUse)
{
uint8_t index;
escAndServoConfig = escAndServoConfigToUse;
for (index = 0; index < MAX_MODE_ACTIVATION_CONDITION_COUNT; index++) {
modeActivationCondition_t *modeActivationCondition = &modeActivationConditions[index];
if (modeActivationCondition->modeId == BOXARM && IS_RANGE_USABLE(&modeActivationCondition->range)) {