From 58d310b20810d06378b24d7b86e210250b3a1fac Mon Sep 17 00:00:00 2001 From: borisbstyle Date: Mon, 18 Jul 2016 17:27:50 +0200 Subject: [PATCH] Fix late stabilisation with zerothrtottle stabilisation feature --- src/main/mw.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/mw.c b/src/main/mw.c index 2848abd40..371961e01 100644 --- a/src/main/mw.c +++ b/src/main/mw.c @@ -485,7 +485,7 @@ void updateMagHold(void) void processRx(void) { static bool armedBeeperOn = false; - static bool wasAirmodeIsActivated; + static bool airmodeIsActivated; calculateRxChannelsAndUpdateFailsafe(currentTime); @@ -509,21 +509,21 @@ void processRx(void) throttleStatus_e throttleStatus = calculateThrottleStatus(&masterConfig.rxConfig, masterConfig.flight3DConfig.deadband3d_throttle); if (isAirmodeActive() && ARMING_FLAG(ARMED)) { - if (rcCommand[THROTTLE] >= masterConfig.rxConfig.airModeActivateThreshold) wasAirmodeIsActivated = true; // Prevent Iterm from being reset + if (rcCommand[THROTTLE] >= masterConfig.rxConfig.airModeActivateThreshold) airmodeIsActivated = true; // Prevent Iterm from being reset } else { - wasAirmodeIsActivated = false; + airmodeIsActivated = false; } /* In airmode Iterm should be prevented to grow when Low thottle and Roll + Pitch Centered. This is needed to prevent Iterm winding on the ground, but keep full stabilisation on 0 throttle while in air */ - if (throttleStatus == THROTTLE_LOW && !wasAirmodeIsActivated) { + if (throttleStatus == THROTTLE_LOW && !airmodeIsActivated) { pidResetErrorGyroState(); if (currentProfile->pidProfile.zeroThrottleStabilisation) pidStabilisationState(PID_STABILISATION_ON); else pidStabilisationState(PID_STABILISATION_OFF); } else { - if (currentProfile->pidProfile.zeroThrottleStabilisation || wasAirmodeIsActivated) pidStabilisationState(PID_STABILISATION_ON); + pidStabilisationState(PID_STABILISATION_ON); } // When armed and motors aren't spinning, do beeps and then disarm