diff --git a/ArduPlane/navigation.cpp b/ArduPlane/navigation.cpp index 762b190ffee722..a9fd136d233faf 100644 --- a/ArduPlane/navigation.cpp +++ b/ArduPlane/navigation.cpp @@ -397,9 +397,10 @@ void Plane::update_fbwb_speed_height(void) int32_t alt_change_cm = g.flybywire_climb_rate * elevator_input * dt * 100; change_target_altitude(alt_change_cm); - if (is_zero(elevator_input) && !is_zero(target_altitude.last_elevator_input)) { - // the user has just released the elevator, lock in - // the current altitude + bool input_stop_climb = !is_positive(elevator_input) && is_positive(target_altitude.last_elevator_input); + bool input_stop_descent = !is_negative(elevator_input) && is_negative(target_altitude.last_elevator_input); + if (input_stop_climb || input_stop_descent) { + // user elevator input reached or passed zero, lock in the current altitude set_target_altitude_current(); }