From 6d42f25105213797df4a9bb57634f2564cc6a9fe Mon Sep 17 00:00:00 2001 From: bkleiner Date: Sat, 16 Sep 2023 01:06:59 +0200 Subject: [PATCH] pid: do not wind down interal when we get stick input --- src/flight/pid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/flight/pid.c b/src/flight/pid.c index 32486525b..e98ffd3f3 100644 --- a/src/flight/pid.c +++ b/src/flight/pid.c @@ -181,8 +181,8 @@ static inline void pid(uint8_t x) { state.pid_p_term.axis[x] *= v_compensation; // I term - if (flags.on_ground || flags.in_air == 0) { - // wind down integral while we are still on ground + if (flags.in_air == 0 && fabsf(state.error.axis[x]) < 0.05f) { + // wind down integral while we are still on ground and we do not get any input from the sticks ierror[x] *= 0.98f; }