mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-18 22:05:17 +03:00
Allow inflight adjustment of throttle expo.
This commit is contained in:
parent
f166ca3516
commit
4a90599e3a
3 changed files with 18 additions and 5 deletions
|
@ -70,6 +70,7 @@ void setPIDController(int type); // FIXME PID code needs to be in flight_pid.c/h
|
|||
void mixerUseConfigs(servoParam_t *servoConfToUse, flight3DConfig_t *flight3DConfigToUse,
|
||||
escAndServoConfig_t *escAndServoConfigToUse, mixerConfig_t *mixerConfigToUse,
|
||||
airplaneConfig_t *airplaneConfigToUse, rxConfig_t *rxConfig, gimbalConfig_t *gimbalConfigToUse);
|
||||
void useRcControlsConfig(modeActivationCondition_t *modeActivationConditions, escAndServoConfig_t *escAndServoConfigToUse);
|
||||
|
||||
#define FLASH_TO_RESERVE_FOR_CONFIG 0x800
|
||||
|
||||
|
@ -432,7 +433,7 @@ void activateConfig(void)
|
|||
|
||||
generatePitchRollCurve(¤tProfile->controlRateConfig);
|
||||
generateThrottleCurve(¤tProfile->controlRateConfig, &masterConfig.escAndServoConfig);
|
||||
useRcControlsConfig(currentProfile->modeActivationConditions);
|
||||
useRcControlsConfig(currentProfile->modeActivationConditions, &masterConfig.escAndServoConfig);
|
||||
|
||||
useGyroConfig(&masterConfig.gyroConfig);
|
||||
#ifdef TELEMETRY
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -137,11 +137,12 @@ typedef enum {
|
|||
ADJUSTMENT_NONE = 0,
|
||||
ADJUSTMENT_RC_RATE,
|
||||
ADJUSTMENT_RC_EXPO,
|
||||
ADJUSTMENT_THROTTLE_EXPO,
|
||||
ADJUSTMENT_PITCH_ROLL_RATE,
|
||||
ADJUSTMENT_YAW_RATE,
|
||||
} adjustmentFunction_e;
|
||||
|
||||
#define ADJUSTMENT_FUNCTION_COUNT 5
|
||||
#define ADJUSTMENT_FUNCTION_COUNT 6
|
||||
|
||||
typedef struct adjustmentConfig_s {
|
||||
uint8_t adjustmentFunction;
|
||||
|
@ -170,5 +171,3 @@ void configureAdjustment(uint8_t index, uint8_t auxChannelIndex, const adjustmen
|
|||
void updateAdjustmentStates(adjustmentRange_t *adjustmentRanges);
|
||||
void processRcAdjustments(controlRateConfig_t *controlRateConfig, rxConfig_t *rxConfig);
|
||||
|
||||
void useRcControlsConfig(modeActivationCondition_t *modeActivationConditions);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue