diff --git a/libraries/AC_Fence/AC_Fence.cpp b/libraries/AC_Fence/AC_Fence.cpp index 3ec8269306..e94658ee26 100644 --- a/libraries/AC_Fence/AC_Fence.cpp +++ b/libraries/AC_Fence/AC_Fence.cpp @@ -543,14 +543,14 @@ uint8_t AC_Fence::check() { uint8_t ret = 0; + // clear any breach from a non-enabled fence + clear_breach(~_enabled_fences); + // return immediately if disabled if ((!_enabled && !_auto_enabled) || !_enabled_fences) { return 0; } - // clear any breach from a non-enabled fence - clear_breach(~_enabled_fences); - // check if pilot is attempting to recover manually if (_manual_recovery_start_ms != 0) { // we ignore any fence breaches during the manual recovery period which is about 10 seconds