From 259e70b2b1470db0a0295f1e29411e56f4bc873c Mon Sep 17 00:00:00 2001 From: Iampete1 Date: Fri, 12 Aug 2022 20:32:28 +0100 Subject: [PATCH] AC_Fence: add options param on plane --- libraries/AC_Fence/AC_Fence.cpp | 7 +++++++ libraries/AC_Fence/AC_Fence.h | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/libraries/AC_Fence/AC_Fence.cpp b/libraries/AC_Fence/AC_Fence.cpp index 10896b88f7..3ec8269306 100644 --- a/libraries/AC_Fence/AC_Fence.cpp +++ b/libraries/AC_Fence/AC_Fence.cpp @@ -134,6 +134,13 @@ const AP_Param::GroupInfo AC_Fence::var_info[] = { // @User: Standard AP_GROUPINFO_FRAME("AUTOENABLE", 10, AC_Fence, _auto_enabled, static_cast(AutoEnable::ALWAYS_DISABLED), AP_PARAM_FRAME_PLANE), + // @Param{Plane}: OPTIONS + // @DisplayName: Fence options + // @Description: 0:Disable mode change following fence action until fence breach is cleared + // @Bitmask: 0:Disable mode change following fence action until fence breach is cleared + // @User: Standard + AP_GROUPINFO_FRAME("OPTIONS", 11, AC_Fence, _options, static_cast(OPTIONS::DISABLE_MODE_CHANGE), AP_PARAM_FRAME_PLANE), + AP_GROUPEND }; diff --git a/libraries/AC_Fence/AC_Fence.h b/libraries/AC_Fence/AC_Fence.h index 5d28cce0b3..0a967310a8 100644 --- a/libraries/AC_Fence/AC_Fence.h +++ b/libraries/AC_Fence/AC_Fence.h @@ -146,6 +146,13 @@ public: AC_PolyFence_loader &polyfence(); const AC_PolyFence_loader &polyfence() const; + enum class OPTIONS { + DISABLE_MODE_CHANGE = 1 << 0, + }; + bool option_enabled(OPTIONS opt) const { + return (_options.get() & int16_t(opt)) != 0; + } + static const struct AP_Param::GroupInfo var_info[]; private: @@ -186,6 +193,7 @@ private: AP_Int8 _total; // number of polygon points saved in eeprom AP_Int8 _ret_rally; // return to fence return point or rally point/home AP_Int16 _ret_altitude; // return to this altitude + AP_Int16 _options; // options bitmask, see OPTIONS enum // backup fences float _alt_max_backup; // backup altitude upper limit in meters used to refire the breach if the vehicle continues to move further away