From faf49934362187575f976bf31b5aba764b7d5325 Mon Sep 17 00:00:00 2001 From: Hwurzburg Date: Tue, 18 May 2021 10:20:49 -0500 Subject: [PATCH] AP_Fence: add pre-arm check for fence enabled but none selected --- libraries/AC_Fence/AC_Fence.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libraries/AC_Fence/AC_Fence.cpp b/libraries/AC_Fence/AC_Fence.cpp index 04fd0992f7..47b4f5e102 100644 --- a/libraries/AC_Fence/AC_Fence.cpp +++ b/libraries/AC_Fence/AC_Fence.cpp @@ -282,6 +282,12 @@ bool AC_Fence::pre_arm_check(const char* &fail_msg) const { fail_msg = nullptr; + // if fences are enabled but none selected fail pre-arm check + if (enabled() && !present()) { + fail_msg = "Fences enabled, but none selected"; + return false; + } + // if not enabled or not fence set-up always return true if ((!_enabled && !_auto_enabled) || !_enabled_fences) { return true;