From 47aedba691c8ca6ab42dda5600dcf42fb2746b85 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 22 Aug 2015 20:27:07 +0200 Subject: [PATCH] TECS: Fix altitude reset logic --- src/lib/external_lgpl/tecs/tecs.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib/external_lgpl/tecs/tecs.cpp b/src/lib/external_lgpl/tecs/tecs.cpp index 9e47590fd2..3c59add864 100644 --- a/src/lib/external_lgpl/tecs/tecs.cpp +++ b/src/lib/external_lgpl/tecs/tecs.cpp @@ -62,6 +62,10 @@ void TECS::update_state(float baro_altitude, float airspeed, const math::Matrix< _integ3_state = baro_altitude; _integ2_state = 0.0f; _integ1_state = 0.0f; + + // Reset the filter state as we just switched from non-altitude control + // to altitude control mode + _states_initalized = false; } _update_50hz_last_usec = now;