From b35b94f55352e288e4035cb0b0b48877a1166823 Mon Sep 17 00:00:00 2001 From: Zach Flathers Date: Sat, 17 Jun 2023 11:29:20 -0700 Subject: [PATCH] Plane: update based on PR feedback --- ArduPlane/Plane.cpp | 18 ++++++------------ ArduPlane/mode_auto.cpp | 2 +- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/ArduPlane/Plane.cpp b/ArduPlane/Plane.cpp index ab13b35f38..fa3a4eb6d4 100644 --- a/ArduPlane/Plane.cpp +++ b/ArduPlane/Plane.cpp @@ -38,11 +38,11 @@ AP_Vehicle& vehicle = plane; // returns true if vehicle is landing. Only used by Lua scripts bool Plane::is_landing() const { - #if HAL_QUADPLANE_ENABLED - - return plane.quadplane.in_vtol_land_descent(); - - #endif // HAL_QUADPLANE_ENABLED +#if HAL_QUADPLANE_ENABLED + if (plane.quadplane.in_vtol_land_descent()) { + return true; + } +#endif return control_mode->is_landing(); } @@ -50,13 +50,7 @@ bool Plane::is_landing() const // returns true if vehicle is taking off. Only used by Lua scripts bool Plane::is_taking_off() const { - #if HAL_QUADPLANE_ENABLED - - return plane.quadplane.in_vtol_takeoff(); - - #endif // HAL_QUADPLANE_ENABLED - - return control_mode->is_taking_off(); + return control_mode->is_taking_off() || (started_flying_ms > 0 && millis() - started_flying_ms < 30000); } #endif // AP_SCRIPTING_ENABLED diff --git a/ArduPlane/mode_auto.cpp b/ArduPlane/mode_auto.cpp index cbbf2fe452..ea6af90f2c 100644 --- a/ArduPlane/mode_auto.cpp +++ b/ArduPlane/mode_auto.cpp @@ -168,7 +168,7 @@ bool ModeAuto::is_landing() const case MAV_CMD_DO_VTOL_TRANSITION: return true; } - return false; + return plane.mission.get_in_landing_sequence_flag(); } bool ModeAuto::is_taking_off() const