diff --git a/ArduPlane/ArduPlane.cpp b/ArduPlane/ArduPlane.cpp index 4325371c2702c3..15c5dc6e7fb44b 100644 --- a/ArduPlane/ArduPlane.cpp +++ b/ArduPlane/ArduPlane.cpp @@ -689,8 +689,6 @@ void Plane::update_flight_stage(void) // This prevents TECS from being stuck in the wrong stage if you switch from // AUTO to, say, FBWB during a landing, an aborted landing or takeoff. set_flight_stage(AP_FixedWing::FlightStage::NORMAL); - } else if (control_mode == &mode_autoland) { - set_flight_stage(AP_FixedWing::FlightStage::LAND); } return; } diff --git a/ArduPlane/mode.h b/ArduPlane/mode.h index c4a044998c3599..902187733b04b6 100644 --- a/ArduPlane/mode.h +++ b/ArduPlane/mode.h @@ -861,6 +861,7 @@ class ModeTakeoff: public Mode class ModeAutoLand: public Mode { +friend class QuadPlane; public: ModeAutoLand(); diff --git a/ArduPlane/mode_autoland.cpp b/ArduPlane/mode_autoland.cpp index 2150f690e4e904..26451773edfd42 100644 --- a/ArduPlane/mode_autoland.cpp +++ b/ArduPlane/mode_autoland.cpp @@ -43,7 +43,7 @@ ModeAutoLand::ModeAutoLand() : } bool ModeAutoLand::_enter() -{ +{ //must be flying to enter if (!plane.is_flying()) { gcs().send_text(MAV_SEVERITY_WARNING, "Must already be flying!"); @@ -51,9 +51,9 @@ bool ModeAutoLand::_enter() } //takeoff direction must be set and must not be a quadplane, otherwise since flying switch to RTL so this can be used as FS action -#if HAL_QUADPLANE_ENABLED - if (quadplane.available()) { - gcs().send_text(MAV_SEVERITY_WARNING, "AutoLand is fixed wing only mode"); +if HAL_QUADPLANE_ENABLED + if (quadplane.available() && !quadplane.option_is_set(QuadPlane::OPTION::ALLOW_FW_LAND)) { + gcs().send_text(MAV_SEVERITY_WARNING, "Option not set to allow fixed wing autoland"); return false; } #endif @@ -105,6 +105,7 @@ void ModeAutoLand::navigate() plane.prev_WP_loc = plane.current_loc; plane.next_WP_loc = home_loc; plane.start_command(cmd); + plane.set_flight_stage(AP_FixedWing::FlightStage::LAND); } return; //otherwise keep flying the current command diff --git a/ArduPlane/servos.cpp b/ArduPlane/servos.cpp index 2ded238cf2f5ba..bfedc7308044a0 100644 --- a/ArduPlane/servos.cpp +++ b/ArduPlane/servos.cpp @@ -696,6 +696,7 @@ void Plane::set_servos_flaps(void) better than speed based flaps as it leads to less possibility of oscillation */ + switch (flight_stage) { case AP_FixedWing::FlightStage::TAKEOFF: case AP_FixedWing::FlightStage::ABORT_LANDING: @@ -710,8 +711,10 @@ void Plane::set_servos_flaps(void) } break; case AP_FixedWing::FlightStage::LAND: + if (landing.get_flap_percent() != 0) { auto_flap_percent = landing.get_flap_percent(); + //GCS_SEND_TEXT(MAV_SEVERITY_WARNING,"Gothere, %u",auto_flap_percent); } break; default: