From 367984a6b8c562d959f09de3e401ad98a727d46c Mon Sep 17 00:00:00 2001 From: Iampete1 Date: Sat, 6 Aug 2022 21:43:59 +0100 Subject: [PATCH] Plane: set fence manual recovery on mode change --- ArduPlane/mode.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ArduPlane/mode.cpp b/ArduPlane/mode.cpp index 3042a93956..2c8bc803e1 100644 --- a/ArduPlane/mode.cpp +++ b/ArduPlane/mode.cpp @@ -101,6 +101,13 @@ bool Mode::enter() // update RC failsafe, as mode change may have necessitated changing the failsafe throttle plane.control_failsafe(); + +#if AP_FENCE_ENABLED + // pilot requested flight mode change during a fence breach indicates pilot is attempting to manually recover + // this flight mode change could be automatic (i.e. fence, battery, GPS or GCS failsafe) + // but it should be harmless to disable the fence temporarily in these situations as well + plane.fence.manual_recovery_start(); +#endif } return enter_result;