From e4bf70fddbad8e5890be9d28b9a31e01110fcb1b Mon Sep 17 00:00:00 2001 From: Henry Wurzburg Date: Tue, 23 Jul 2024 19:12:43 -0500 Subject: [PATCH] AC_Fence:Add AUTOENABLE deprecation warning --- libraries/AC_Fence/AC_Fence.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libraries/AC_Fence/AC_Fence.cpp b/libraries/AC_Fence/AC_Fence.cpp index 743877cc1e7f83..4420c910469325 100644 --- a/libraries/AC_Fence/AC_Fence.cpp +++ b/libraries/AC_Fence/AC_Fence.cpp @@ -429,6 +429,17 @@ bool AC_Fence::pre_arm_check(char *failure_msg, const uint8_t failure_msg_len) c hal.util->snprintf(failure_msg, failure_msg_len, "Fences enabled, but none selected"); return false; } + + // if AUTOENABLE = 1 or 2 warn now, but fail in a later release + // PARAMETER_CONVERSION - Added: Jul-2024 for ArduPilot-4.6 + const uint32_t now_ms = AP_HAL::millis(); + static uint32_t _last_autoenable_warn_ms = now_ms - 60000; //needs this static since function is const + if (now_ms - _last_autoenable_warn_ms > 60000) { + if (_auto_enabled == 1 or _auto_enabled == 2) { + GCS_SEND_TEXT(MAV_SEVERITY_WARNING, "FENCE_AUTOENABLE is %u, will be deprecated in 4.7, use 3", unsigned(_auto_enabled)); + _last_autoenable_warn_ms = now_ms; + } + } // if not enabled or not fence set-up always return true if ((!enabled() && !_auto_enabled) || !_configured_fences) {