diff --git a/ArduPlane/quadplane.cpp b/ArduPlane/quadplane.cpp index 05a79484577301..ebb13affb11b73 100644 --- a/ArduPlane/quadplane.cpp +++ b/ArduPlane/quadplane.cpp @@ -4189,6 +4189,22 @@ bool QuadPlane::in_vtol_airbrake(void) const return false; } +QuadPlane::VTOL_Landing_State QuadPlane::get_vtol_landing_state() const { + if (in_vtol_land_approach()) { + return VTOL_Landing_State::APPROACH; + } else if (in_vtol_land_final()) { + return VTOL_Landing_State::FINAL; + } else if (in_vtol_land_sequence()) { + return VTOL_Landing_State::SEQUENCE; + } else if (in_vtol_land_poscontrol()) { + return VTOL_Landing_State::POSCONTROL; + } else if (in_vtol_airbrake()) { + return VTOL_Landing_State::AIRBRAKE; + } else { + return VTOL_Landing_State::NONE; + } +} + // return true if we should show VTOL view bool QuadPlane::show_vtol_view() const { diff --git a/ArduPlane/quadplane.h b/ArduPlane/quadplane.h index 2ced92498b423f..9b2c07ca5c3d3a 100644 --- a/ArduPlane/quadplane.h +++ b/ArduPlane/quadplane.h @@ -720,6 +720,20 @@ class QuadPlane MAV_RESULT mavlink_motor_test_start(mavlink_channel_t chan, uint8_t motor_seq, uint8_t throttle_type, uint16_t throttle_value, float timeout_sec, uint8_t motor_count); + + // Enum for VTOL landing states + enum class VTOL_Landing_State { + NONE, + APPROACH, + FINAL, + SEQUENCE, + POSCONTROL, + AIRBRAKE + }; + + // function to get the VTOL landing state + VTOL_Landing_State get_vtol_landing_state() const; + private: void motor_test_stop();