Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Tools/scripts/build_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def config_option(self):
Feature('AHRS', 'BARO_WIND_COMP', 'HAL_BARO_WIND_COMP_ENABLED', 'Enable Baro wind compensation', 0, None),

Feature('Safety', 'PARACHUTE', 'HAL_PARACHUTE_ENABLED', 'Enable Parachute', 0, None),
Feature('Safety', 'FENCE', 'AP_FENCE_ENABLED', 'Enable Geofences', 2, None),
Feature('Safety', 'FENCE', 'AP_FENCE_ENABLED', 'Enable Geofences', 1, None),
Feature('Safety', 'RALLY', 'HAL_RALLY_ENABLED', 'Enable Rally points', 0, None), # noqa
Feature('Safety', 'AC_AVOID', 'AP_AVOIDANCE_ENABLED', 'Enable Object Avoidance', 0, 'FENCE'),
Feature('Safety', 'AC_OAPATHPLANNER', 'AP_OAPATHPLANNER_ENABLED', 'Enable Object Avoidance Path Planner', 0, 'FENCE'),
Expand Down
5 changes: 4 additions & 1 deletion libraries/AC_Fence/AC_Fence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

#include <AP_Vehicle/AP_Vehicle_Type.h>

// AC_FENCE_DUMMY_METHODS_ENABLED helps compiling the binaries with dummy methods for blimp and tracker
// It might be defined at multiple places; ensure consistency while changing definition
#ifndef AC_FENCE_DUMMY_METHODS_ENABLED
#define AC_FENCE_DUMMY_METHODS_ENABLED (!(APM_BUILD_TYPE(APM_BUILD_Rover) | APM_BUILD_COPTER_OR_HELI | APM_BUILD_TYPE(APM_BUILD_ArduPlane) | APM_BUILD_TYPE(APM_BUILD_ArduSub) | (AP_FENCE_ENABLED == 1)))
#define AC_FENCE_DUMMY_METHODS_ENABLED (APM_BUILD_TYPE(APM_BUILD_Blimp) | APM_BUILD_TYPE(APM_BUILD_AntennaTracker))
#endif

#if !AC_FENCE_DUMMY_METHODS_ENABLED
Expand Down Expand Up @@ -1138,6 +1140,7 @@ float AC_Fence::get_breach_distance(uint8_t fence_type) const { return 0.0; }
bool AC_Fence::get_breach_direction_NED(uint8_t fence_type, Vector3f& direction, Location& fence_check_pos) const { return false; }
void AC_Fence::get_fence_names(uint8_t fences, ExpandingString& msg) { }
void AC_Fence::print_fence_message(const char* msg, uint8_t fences) const {}
float AC_Fence::get_margin_ne_m() const { return 0.0; }

void AC_Fence::manual_recovery_start() {}

Expand Down
10 changes: 5 additions & 5 deletions libraries/AC_Fence/AC_Fence_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

#include <GCS_MAVLink/GCS_config.h>

// Enabled 0 is compiled out
// Enabled 1 is always enabled on all vehicles
// Enabled 2 is enabled with dummy methods for tracker and blimp

#ifndef AP_FENCE_ENABLED
#define AP_FENCE_ENABLED 2
#define AP_FENCE_ENABLED 1
#endif

#if AP_FENCE_ENABLED == 2
#error "AP_FENCE_ENABLED no longer supports the value 2. For toggling dummy methods in AC_Fence, use AC_FENCE_DUMMY_METHODS_ENABLED instead."
#endif

// CODE_REMOVAL
Expand Down
6 changes: 3 additions & 3 deletions libraries/AC_Fence/AC_PolyFence_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
#include <AP_Vehicle/AP_Vehicle_Type.h>
#include <AP_BoardConfig/AP_BoardConfig.h>

// AC_FENCE_DUMMY_METHODS_ENABLED helps compiling the binaries with dummy methods for blimp and tracker
// It might be defined at multiple places; ensure consistency while changing definition
#ifndef AC_FENCE_DUMMY_METHODS_ENABLED
#define AC_FENCE_DUMMY_METHODS_ENABLED (!(APM_BUILD_TYPE(APM_BUILD_Rover) | APM_BUILD_COPTER_OR_HELI | APM_BUILD_TYPE(APM_BUILD_ArduPlane) | APM_BUILD_TYPE(APM_BUILD_ArduSub) | (AP_FENCE_ENABLED == 1)))
#define AC_FENCE_DUMMY_METHODS_ENABLED (APM_BUILD_TYPE(APM_BUILD_Blimp) | APM_BUILD_TYPE(APM_BUILD_AntennaTracker))
#endif

#if !AC_FENCE_DUMMY_METHODS_ENABLED
Expand Down Expand Up @@ -1711,9 +1713,7 @@ bool AC_PolyFence_loader::write_fence(const AC_PolyFenceItem *new_items, uint16_

void AC_PolyFence_loader::update() {};

#if AC_POLYFENCE_FENCE_POINT_PROTOCOL_SUPPORT
Copy link
Member Author

@shiv-tyagi shiv-tyagi Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going because:-

  1. we do not wrap the call to this method with this define.
  2. the non-dummy implementation for this method is also not wrapped under this define

bool AC_PolyFence_loader::get_return_point(Vector2l &ret) { return false; }
#endif

#endif // #if AC_FENCE_DUMMY_METHODS_ENABLED
#endif // AP_FENCE_ENABLED
Loading