Plane: prevent rapid RTL/AUTO switching on fence breach

don't switch back to RTL if already in a DO_LAND_START sequence
This commit is contained in:
Andrew Tridgell 2022-03-23 12:55:09 +11:00 committed by Randy Mackay
parent a977898bd3
commit b764b4c1e4
1 changed files with 6 additions and 0 deletions

View File

@ -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);