Browse Source

AC_Fence: accept curr_alt parameter instead of getting alt from inav

master
Jonathan Challinger 10 years ago committed by Randy Mackay
parent
commit
05fda4ee4c
  1. 5
      libraries/AC_Fence/AC_Fence.cpp
  2. 2
      libraries/AC_Fence/AC_Fence.h

5
libraries/AC_Fence/AC_Fence.cpp

@ -111,7 +111,7 @@ bool AC_Fence::pre_arm_check() const @@ -111,7 +111,7 @@ bool AC_Fence::pre_arm_check() const
}
/// check_fence - returns the fence type that has been breached (if any)
uint8_t AC_Fence::check_fence()
uint8_t AC_Fence::check_fence(float curr_alt)
{
uint8_t ret = AC_FENCE_TYPE_NONE;
@ -131,9 +131,6 @@ uint8_t AC_Fence::check_fence() @@ -131,9 +131,6 @@ uint8_t AC_Fence::check_fence()
}
}
// get current altitude in meters
float curr_alt = _inav.get_altitude() * 0.01f;
// altitude fence check
if ((_enabled_fences & AC_FENCE_TYPE_ALT_MAX) != 0) {

2
libraries/AC_Fence/AC_Fence.h

@ -52,7 +52,7 @@ public: @@ -52,7 +52,7 @@ public:
///
/// check_fence - returns the fence type that has been breached (if any)
uint8_t check_fence();
uint8_t check_fence(float curr_alt);
/// get_breaches - returns bit mask of the fence types that have been breached
uint8_t get_breaches() const { return _breached_fences; }

Loading…
Cancel
Save