From 042257c33fee11dda8ae01e2b1f8215eb3c3d947 Mon Sep 17 00:00:00 2001 From: Konrad Date: Fri, 12 Jan 2024 11:50:17 +0100 Subject: [PATCH] TECS: fast descend only available if airspeed is available. --- src/lib/tecs/TECS.cpp | 3 ++- src/lib/tecs/TECS.hpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/tecs/TECS.cpp b/src/lib/tecs/TECS.cpp index 867df64caa..30f7822885 100644 --- a/src/lib/tecs/TECS.cpp +++ b/src/lib/tecs/TECS.cpp @@ -773,7 +773,8 @@ bool TECS::_checkFastDescend(const float alt_setpoint, const float alt) { bool ret_val{false}; - if ((_fast_descend_alt_err > FLT_EPSILON) && ((alt_setpoint + _fast_descend_alt_err) < alt)) { + if (_control_flag.airspeed_enabled && (_fast_descend_alt_err > FLT_EPSILON) + && ((alt_setpoint + _fast_descend_alt_err) < alt)) { ret_val = true; } diff --git a/src/lib/tecs/TECS.hpp b/src/lib/tecs/TECS.hpp index 9192e29668..88baed65ba 100644 --- a/src/lib/tecs/TECS.hpp +++ b/src/lib/tecs/TECS.hpp @@ -729,6 +729,7 @@ private: TECSControl::Flag _control_flag{ .airspeed_enabled = false, .detect_underspeed_enabled = false, + .fast_descend = false }; /**