mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 08:15:30 +03:00
Fix throttle angle correction when smoothing throttle; reduce processing overhead
Change the logic to not modify rcCommand directly and instead apply the additional throttle directly in the mixer. Also move the logic to the attitude task instead of having it calculate in the PID loop. The logic relies on an angle that's only updated in the attitude task so there was no point in running the calculation every PID loop.
This commit is contained in:
parent
e260c37be3
commit
5cd886017d
7 changed files with 41 additions and 25 deletions
|
@ -125,6 +125,8 @@ float motor_disarmed[MAX_SUPPORTED_MOTORS];
|
|||
mixerMode_e currentMixerMode;
|
||||
static motorMixer_t currentMixer[MAX_SUPPORTED_MOTORS];
|
||||
|
||||
static FAST_RAM_ZERO_INIT int throttleAngleCorrection;
|
||||
|
||||
|
||||
static const motorMixer_t mixerQuadX[] = {
|
||||
{ 1.0f, -1.0f, 1.0f, -1.0f }, // REAR_R
|
||||
|
@ -606,7 +608,7 @@ static void calculateThrottleAndCurrentMotorEndpoints(timeUs_t currentTimeUs)
|
|||
pidResetITerm();
|
||||
}
|
||||
} else {
|
||||
throttle = rcCommand[THROTTLE] - rxConfig()->mincheck;
|
||||
throttle = rcCommand[THROTTLE] - rxConfig()->mincheck + throttleAngleCorrection;
|
||||
currentThrottleInputRange = rcCommandThrottleRange;
|
||||
motorRangeMin = motorOutputLow;
|
||||
motorRangeMax = motorOutputHigh;
|
||||
|
@ -888,3 +890,8 @@ uint16_t convertMotorToExternal(float motorValue)
|
|||
|
||||
return externalValue;
|
||||
}
|
||||
|
||||
void mixerSetThrottleAngleCorrection(int correctionValue)
|
||||
{
|
||||
throttleAngleCorrection = correctionValue;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue