mirror of https://github.com/ArduPilot/ardupilot
AC_Fence: allow compilation with HAL_LOGGING_ENABLED false
This commit is contained in:
parent
b1c29c5033
commit
78daf8911b
|
@ -160,11 +160,13 @@ AC_Fence::AC_Fence()
|
|||
/// enable the Fence code generally; a master switch for all fences
|
||||
void AC_Fence::enable(bool value)
|
||||
{
|
||||
#if HAL_LOGGING_ENABLED
|
||||
if (_enabled && !value) {
|
||||
AP::logger().Write_Event(LogEvent::FENCE_DISABLE);
|
||||
} else if (!_enabled && value) {
|
||||
AP::logger().Write_Event(LogEvent::FENCE_ENABLE);
|
||||
}
|
||||
#endif
|
||||
_enabled.set(value);
|
||||
if (!value) {
|
||||
clear_breach(AC_FENCE_TYPE_ALT_MIN | AC_FENCE_TYPE_ALT_MAX | AC_FENCE_TYPE_CIRCLE | AC_FENCE_TYPE_POLYGON);
|
||||
|
@ -177,19 +179,23 @@ void AC_Fence::enable(bool value)
|
|||
/// enable/disable fence floor only
|
||||
void AC_Fence::enable_floor()
|
||||
{
|
||||
#if HAL_LOGGING_ENABLED
|
||||
if (!_floor_enabled) {
|
||||
// Floor is currently disabled, enable it
|
||||
AP::logger().Write_Event(LogEvent::FENCE_FLOOR_ENABLE);
|
||||
}
|
||||
#endif
|
||||
_floor_enabled = true;
|
||||
}
|
||||
|
||||
void AC_Fence::disable_floor()
|
||||
{
|
||||
#if HAL_LOGGING_ENABLED
|
||||
if (_floor_enabled) {
|
||||
// Floor is currently enabled, disable it
|
||||
AP::logger().Write_Event(LogEvent::FENCE_FLOOR_DISABLE);
|
||||
}
|
||||
#endif
|
||||
_floor_enabled = false;
|
||||
clear_breach(AC_FENCE_TYPE_ALT_MIN);
|
||||
}
|
||||
|
|
|
@ -1121,8 +1121,10 @@ bool AC_PolyFence_loader::write_fence(const AC_PolyFenceItem *new_items, uint16_
|
|||
gcs().send_text(MAV_SEVERITY_DEBUG, "Fence Indexed OK");
|
||||
#endif
|
||||
|
||||
#if HAL_LOGGING_ENABLED
|
||||
// start logger logging new fence
|
||||
AP::logger().Write_Fence();
|
||||
#endif
|
||||
|
||||
void_index();
|
||||
|
||||
|
|
Loading…
Reference in New Issue