diff options
Diffstat (limited to 'src/modules/navigator/geofence.cpp')
-rw-r--r-- | src/modules/navigator/geofence.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/modules/navigator/geofence.cpp b/src/modules/navigator/geofence.cpp index a49a71e1b..9bbaf167a 100644 --- a/src/modules/navigator/geofence.cpp +++ b/src/modules/navigator/geofence.cpp @@ -58,9 +58,11 @@ static const int ERROR = -1; Geofence::Geofence() : _fence_pub(-1), _altitude_min(0), _altitude_max(0), - _verticesCount(0) + _verticesCount(0), + param_geofence_on(NULL, "GF_ON", false) { - + /* Load initial params */ + updateParams(); } Geofence::~Geofence() @@ -80,6 +82,10 @@ bool Geofence::inside(const struct vehicle_global_position_s *vehicle) bool Geofence::inside(double lat, double lon, float altitude) { + /* Return true if geofence is disabled */ + if (param_geofence_on.get() != 1) + return true; + if (valid()) { if (!isEmpty()) { @@ -286,3 +292,8 @@ int Geofence::clearDm() { dm_clear(DM_KEY_FENCE_POINTS); } + +void Geofence::updateParams() +{ + param_geofence_on.update(); +} |