From eb76b0ce552e0f7551315134901382511cbf9627 Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Fri, 24 Nov 2023 17:51:17 +0100 Subject: [PATCH] FlightTaskManualAltitude: refactor horizontal stick input check --- .../tasks/ManualAltitude/FlightTaskManualAltitude.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/modules/flight_mode_manager/tasks/ManualAltitude/FlightTaskManualAltitude.cpp b/src/modules/flight_mode_manager/tasks/ManualAltitude/FlightTaskManualAltitude.cpp index 3173a0c7d2..f18f73baa0 100644 --- a/src/modules/flight_mode_manager/tasks/ManualAltitude/FlightTaskManualAltitude.cpp +++ b/src/modules/flight_mode_manager/tasks/ManualAltitude/FlightTaskManualAltitude.cpp @@ -115,8 +115,7 @@ void FlightTaskManualAltitude::_updateAltitudeLock() float spd_xy = Vector2f(_velocity).length(); // Use presence of horizontal stick inputs as a transition criteria - float stick_xy = Vector2f(_sticks.getPitchRollExpo()).length(); - bool stick_input = stick_xy > 0.001f; + bool stick_input = _sticks.getPitchRollExpo().longerThan(FLT_EPSILON); if (_terrain_hold) { bool too_fast = spd_xy > _param_mpc_hold_max_xy.get(); @@ -147,7 +146,6 @@ void FlightTaskManualAltitude::_updateAltitudeLock() } } } - } if ((_param_mpc_alt_mode.get() == 1 || _terrain_hold) && PX4_ISFINITE(_dist_to_bottom)) {