From d72ded4a9ef06254995c09adacbd7926101b988e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 4 Mar 2019 17:37:13 +1100 Subject: [PATCH] AP_TECS: prevent numerical error with zero max throttle --- libraries/AP_TECS/AP_TECS.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/AP_TECS/AP_TECS.cpp b/libraries/AP_TECS/AP_TECS.cpp index d6ea880ff4..0b11e67f62 100644 --- a/libraries/AP_TECS/AP_TECS.cpp +++ b/libraries/AP_TECS/AP_TECS.cpp @@ -988,6 +988,9 @@ void AP_TECS::update_pitch_throttle(int32_t hgt_dem_cm, } _THRminf = aparm.throttle_min * 0.01f; + // min of 1% throttle range to prevent a numerical error + _THRmaxf = MAX(_THRmaxf, _THRminf+0.01); + // work out the maximum and minimum pitch // if TECS_PITCH_{MAX,MIN} isn't set then use // LIM_PITCH_{MAX,MIN}. Don't allow TECS_PITCH_{MAX,MIN} to be