diff --git a/libraries/AP_Arming/AP_Arming.cpp b/libraries/AP_Arming/AP_Arming.cpp index a24fb1d3a1..0c5273ee34 100644 --- a/libraries/AP_Arming/AP_Arming.cpp +++ b/libraries/AP_Arming/AP_Arming.cpp @@ -1099,6 +1099,7 @@ bool AP_Arming::can_checks(bool report) bool AP_Arming::fence_checks(bool display_failure) { +#if AC_FENCE const AC_Fence *fence = AP::fence(); if (fence == nullptr) { return true; @@ -1117,6 +1118,9 @@ bool AP_Arming::fence_checks(bool display_failure) } return false; +#else + return true; +#endif } bool AP_Arming::camera_checks(bool display_failure) @@ -1384,6 +1388,7 @@ bool AP_Arming::arm_checks(AP_Arming::Method method) } } +#if AC_FENCE AC_Fence *fence = AP::fence(); if (fence != nullptr) { // If a fence is set to auto-enable, turn on the fence @@ -1391,7 +1396,8 @@ bool AP_Arming::arm_checks(AP_Arming::Method method) fence->enable(true); } } - +#endif + // note that this will prepare AP_Logger to start logging // so should be the last check to be done before arming @@ -1489,12 +1495,14 @@ bool AP_Arming::disarm(const AP_Arming::Method method, bool do_disarm_checks) } #endif +#if AC_FENCE AC_Fence *fence = AP::fence(); if (fence != nullptr) { if(fence->auto_enabled() == AC_Fence::AutoEnable::ONLY_WHEN_ARMED) { fence->enable(false); } } +#endif return true; }