From 23b0e79eff2f71ac20f972727da7f467f7a3346f Mon Sep 17 00:00:00 2001 From: borisbstyle Date: Mon, 30 May 2016 19:47:53 +0200 Subject: [PATCH] Smoother Iterm Ignore transition --- src/main/config/config.c | 4 ++-- src/main/flight/pid.c | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/config/config.c b/src/main/config/config.c index 4ac6984a6..910954cdc 100755 --- a/src/main/config/config.c +++ b/src/main/config/config.c @@ -184,8 +184,8 @@ static void resetPidProfile(pidProfile_t *pidProfile) pidProfile->yaw_p_limit = YAW_P_LIMIT_MAX; pidProfile->yaw_lpf_hz = 80; - pidProfile->rollPitchItermIgnoreRate = 900; - pidProfile->yawItermIgnoreRate = 35; + pidProfile->rollPitchItermIgnoreRate = 200; + pidProfile->yawItermIgnoreRate = 45; 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 11fb52abb..3e741c0c0 100644 --- a/src/main/flight/pid.c +++ b/src/main/flight/pid.c @@ -106,8 +106,7 @@ uint16_t getDynamicKi(int axis, const pidProfile_t *pidProfile) { resetRate = (axis == YAW) ? pidProfile->yawItermIgnoreRate : pidProfile->rollPitchItermIgnoreRate; - uint32_t dynamicFactor = (1 << 8) - constrain((ABS(gyroADC[axis]) << 6) / resetRate, 0, 1 << 8); - + uint32_t dynamicFactor = ((resetRate << 16) / (resetRate + ABS(gyroADC[axis]))) >> 8; dynamicKi = (pidProfile->I8[axis] * dynamicFactor) >> 8; return dynamicKi;