From e72b5ff9cd3825f3cce367ffbec682ce9cdf8052 Mon Sep 17 00:00:00 2001 From: "Luke.Qin" Date: Tue, 26 Nov 2019 14:41:52 +0800 Subject: [PATCH] AC_PosControl: fix minor bug for set_max_speed_z() to really do numeric check. --- libraries/AC_AttitudeControl/AC_PosControl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/AC_AttitudeControl/AC_PosControl.cpp b/libraries/AC_AttitudeControl/AC_PosControl.cpp index 9aae19e4dc..3c5ed5ec31 100644 --- a/libraries/AC_AttitudeControl/AC_PosControl.cpp +++ b/libraries/AC_AttitudeControl/AC_PosControl.cpp @@ -253,7 +253,7 @@ void AC_PosControl::set_max_speed_z(float speed_down, float speed_up) speed_down = -fabsf(speed_down); // only update if there is a minimum of 1cm/s change and is valid - if (((fabsf(_speed_down_cms - speed_down) > 1.0f) || (fabsf(_speed_up_cms - speed_up) > 1.0f)) && is_positive(_speed_up_cms) && is_negative(_speed_down_cms) ) { + if (((fabsf(_speed_down_cms - speed_down) > 1.0f) || (fabsf(_speed_up_cms - speed_up) > 1.0f)) && is_positive(speed_up) && is_negative(speed_down) ) { _speed_down_cms = speed_down; _speed_up_cms = speed_up; _flags.recalc_leash_z = true;