diff --git a/libraries/AP_TECS/AP_TECS.cpp b/libraries/AP_TECS/AP_TECS.cpp index 0b11e67f62..61868de86f 100644 --- a/libraries/AP_TECS/AP_TECS.cpp +++ b/libraries/AP_TECS/AP_TECS.cpp @@ -1020,7 +1020,8 @@ void AP_TECS::update_pitch_throttle(int32_t hgt_dem_cm, // and use max pitch from TECS_LAND_PMAX if (_land_pitch_max != 0) { - _PITCHmaxf = MIN(_PITCHmaxf, _land_pitch_max); + // note that this allows a flare pitch outside the normal TECS auto limits + _PITCHmaxf = _land_pitch_max; } // and allow zero throttle @@ -1058,6 +1059,9 @@ void AP_TECS::update_pitch_throttle(int32_t hgt_dem_cm, _PITCHmaxf = radians(_PITCHmaxf); _PITCHminf = radians(_PITCHminf); + // don't allow max pitch to go below min pitch + _PITCHmaxf = MAX(_PITCHmaxf, _PITCHminf); + // initialise selected states and variables if DT > 1 second or in climbout _initialise_states(ptchMinCO_cd, hgt_afe);