AP_Arming: fix complation without fence

This commit is contained in:
Iampete1 2022-03-04 16:37:29 +00:00 committed by Andrew Tridgell
parent 2d8b9f7cbe
commit b3d0d4f33d
1 changed files with 9 additions and 1 deletions

View File

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