Skip to content

Commit 9338d48

Browse files
committed
Plane: on wp set or fence disable re-arm fence
allows for continue mission after fence breach with pilot command to change WP
1 parent 7e921c6 commit 9338d48

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

ArduPlane/fence.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,17 @@ void Plane::fence_check()
5252
// No returning to a previous mode, unless our action allows it
5353
break;
5454
}
55+
56+
/*
57+
clear mode reasons if they are FENCE_BREACHED to allow AUX
58+
switch fence disable/enable to re-enable the fence after a breach
59+
*/
60+
if (plane.previous_mode_reason == ModeReason::FENCE_BREACHED) {
61+
plane.previous_mode_reason = ModeReason::FENCE_REENABLE;
62+
}
63+
if (plane.control_mode_reason == ModeReason::FENCE_BREACHED) {
64+
plane.control_mode_reason = ModeReason::FENCE_REENABLE;
65+
}
5566
return;
5667
}
5768

@@ -169,6 +180,11 @@ bool Plane::fence_stickmixing(void) const
169180

170181
bool Plane::in_fence_recovery() const
171182
{
183+
if (control_mode == &mode_auto && !mission.get_in_landing_sequence_flag()) {
184+
// the user may have changed target WP to be outside the
185+
// landing sequence
186+
return false;
187+
}
172188
const bool current_mode_breach = plane.control_mode_reason == ModeReason::FENCE_BREACHED;
173189
const bool previous_mode_breach = plane.previous_mode_reason == ModeReason::FENCE_BREACHED;
174190
const bool previous_mode_complete = (plane.control_mode_reason == ModeReason::RTL_COMPLETE_SWITCHING_TO_VTOL_LAND_RTL) ||

0 commit comments

Comments
 (0)