diff --git a/libraries/AC_Fence/AC_Fence.cpp b/libraries/AC_Fence/AC_Fence.cpp index cdbf55e51f..f078bd5eb0 100644 --- a/libraries/AC_Fence/AC_Fence.cpp +++ b/libraries/AC_Fence/AC_Fence.cpp @@ -524,7 +524,7 @@ bool AC_Fence::check_fence_alt_max() float alt; AP::ahrs().get_relative_position_D_home(alt); - _curr_alt = -alt; // translate Down to Up + const float _curr_alt = -alt; // translate Down to Up // check if we are over the altitude fence if (_curr_alt >= _alt_max) { @@ -573,7 +573,7 @@ bool AC_Fence::check_fence_alt_min() float alt; AP::ahrs().get_relative_position_D_home(alt); - _curr_alt = -alt; // translate Down to Up + const float _curr_alt = -alt; // translate Down to Up // check if we are under the altitude fence if (_curr_alt <= _alt_min) { @@ -625,7 +625,7 @@ bool AC_Fence::auto_enable_fence_floor() float alt; AP::ahrs().get_relative_position_D_home(alt); - _curr_alt = -alt; // translate Down to Up + const float _curr_alt = -alt; // translate Down to Up // check if we are over the altitude fence if (!floor_enabled() && _curr_alt >= _alt_min + _margin) { diff --git a/libraries/AC_Fence/AC_Fence.h b/libraries/AC_Fence/AC_Fence.h index 3165d7b73d..8ed6817d69 100644 --- a/libraries/AC_Fence/AC_Fence.h +++ b/libraries/AC_Fence/AC_Fence.h @@ -251,8 +251,6 @@ private: // other internal variables uint8_t _auto_enable_mask = AC_FENCE_ALL_FENCES; // fences that can be auto-enabled or auto-disabled float _home_distance; // distance from home in meters (provided by main code) - float _curr_alt; - // breach information uint8_t _breached_fences; // bitmask holding the fence type that was breached (i.e. AC_FENCE_TYPE_ALT_MIN, AC_FENCE_TYPE_CIRCLE)