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

IDLE updates

This commit is contained in:
Thorsten Laux 2019-07-22 08:49:59 +02:00
parent d474df3149
commit ba2c1e9264
2 changed files with 5 additions and 4 deletions

View file

@ -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;
}

View file

@ -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