Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
IDLE updates
  • Loading branch information
joelucid committed Aug 2, 2019
1 parent d474df3 commit ba2c1e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/main/flight/mixer.c
Expand Up @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/flight/pid.c
Expand Up @@ -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
Expand Down

0 comments on commit ba2c1e9

Please sign in to comment.