From b764b4c1e4363b0ac795d2f98a006bdc9ad4b749 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 23 Mar 2022 12:55:09 +1100 Subject: [PATCH] Plane: prevent rapid RTL/AUTO switching on fence breach don't switch back to RTL if already in a DO_LAND_START sequence --- ArduPlane/fence.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ArduPlane/fence.cpp b/ArduPlane/fence.cpp index d22a50bb75..47465a90f9 100644 --- a/ArduPlane/fence.cpp +++ b/ArduPlane/fence.cpp @@ -65,6 +65,12 @@ void Plane::fence_check() case AC_FENCE_ACTION_GUIDED_THROTTLE_PASS: case AC_FENCE_ACTION_RTL_AND_LAND: if (fence_act == AC_FENCE_ACTION_RTL_AND_LAND) { + if (control_mode == &mode_auto && + mission.get_in_landing_sequence_flag() && + (g.rtl_autoland == 1 || g.rtl_autoland == 2)) { + // already landing + return; + } set_mode(mode_rtl, ModeReason::FENCE_BREACHED); } else { set_mode(mode_guided, ModeReason::FENCE_BREACHED);