mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 21:05:35 +03:00
IDLE updates
This commit is contained in:
parent
d474df3149
commit
ba2c1e9264
2 changed files with 5 additions and 4 deletions
|
@ -577,11 +577,12 @@ static void calculateThrottleAndCurrentMotorEndpoints(timeUs_t currentTimeUs)
|
|||
static float motorRangeMinIncrease = 0;
|
||||
if (currentPidProfile->idle_hz) {
|
||||
static float oldMinRpm;
|
||||
const float maxIncrease = isAirmodeActivated() ? currentPidProfile->idle_max_increase * 0.001f : 0.04f;
|
||||
const float minRpm = rpmMinMotorSpeed();
|
||||
const float targetRpmChangeRate = (currentPidProfile->idle_hz - minRpm) * currentPidProfile->idle_adjustment_speed;
|
||||
const float error = targetRpmChangeRate - (minRpm - oldMinRpm) * pidFrequency;
|
||||
const float pidSum = constrainf(currentPidProfile->idle_p * 0.0001f * error, -currentPidProfile->idle_pid_limit, currentPidProfile->idle_pid_limit);
|
||||
motorRangeMinIncrease = constrainf(motorRangeMinIncrease + pidSum * dT, 0.0f, currentPidProfile->idle_max_increase * 0.001);
|
||||
motorRangeMinIncrease = constrainf(motorRangeMinIncrease + pidSum * dT, 0.0f, maxIncrease);
|
||||
oldMinRpm = minRpm;
|
||||
}
|
||||
|
||||
|
|
|
@ -207,10 +207,10 @@ void resetPidProfile(pidProfile_t *pidProfile)
|
|||
.transient_throttle_limit = 15,
|
||||
.profileName = { 0 },
|
||||
.idle_hz = 0,
|
||||
.idle_adjustment_speed = 50,
|
||||
.idle_adjustment_speed = 200,
|
||||
.idle_throttle = 60,
|
||||
.idle_p = 20,
|
||||
.idle_pid_limit = 100,
|
||||
.idle_p = 40,
|
||||
.idle_pid_limit = 200,
|
||||
.idle_max_increase = 150,
|
||||
);
|
||||
#ifndef USE_D_MIN
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue