From 935ad7f61351aba47de95bb6f4472cbd4ac2fb7d Mon Sep 17 00:00:00 2001 From: borisbstyle Date: Wed, 25 May 2016 22:43:06 +0200 Subject: [PATCH] Fix Luxfloat iterm issue // New Ignore Iterm default --- src/main/config/config.c | 4 ++-- src/main/flight/pid.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/config/config.c b/src/main/config/config.c index e718bcea0..081084c07 100755 --- a/src/main/config/config.c +++ b/src/main/config/config.c @@ -161,7 +161,7 @@ static void resetPidProfile(pidProfile_t *pidProfile) pidProfile->D8[PITCH] = 15; pidProfile->P8[YAW] = 90; pidProfile->I8[YAW] = 45; - pidProfile->D8[YAW] = 10; + pidProfile->D8[YAW] = 20; pidProfile->P8[PIDALT] = 50; pidProfile->I8[PIDALT] = 0; pidProfile->D8[PIDALT] = 0; @@ -184,7 +184,7 @@ static void resetPidProfile(pidProfile_t *pidProfile) pidProfile->yaw_p_limit = YAW_P_LIMIT_MAX; pidProfile->yaw_lpf_hz = 80; - pidProfile->rollPitchItermIgnoreRate = 180; + pidProfile->rollPitchItermIgnoreRate = 900; pidProfile->yawItermIgnoreRate = 35; pidProfile->dterm_lpf_hz = 110; // filtering ON by default pidProfile->dynamic_pid = 1; diff --git a/src/main/flight/pid.c b/src/main/flight/pid.c index 96cf037ca..5983e7a29 100644 --- a/src/main/flight/pid.c +++ b/src/main/flight/pid.c @@ -222,7 +222,7 @@ static void pidLuxFloat(const pidProfile_t *pidProfile, const controlRateConfig_ // -----calculate I component. uint16_t kI = (pidProfile->dynamic_pid) ? getDynamicKi(axis, pidProfile) : pidProfile->I8[axis]; - errorGyroIf[axis] = constrainf(kI + luxITermScale * RateError * getdT() * pidProfile->I8[axis], -250.0f, 250.0f); + errorGyroIf[axis] = constrainf(errorGyroIf[axis] + luxITermScale * RateError * getdT() * kI, -250.0f, 250.0f); // limit maximum integrator value to prevent WindUp - accumulating extreme values when system is saturated. // I coefficient (I8) moved before integration to make limiting independent from PID settings