aboutsummaryrefslogtreecommitdiff
path: root/src/modules/navigator/geofence.cpp
diff options
context:
space:
mode:
authorThomas Gubler <thomasgubler@gmail.com>2014-01-05 10:49:16 +0100
committerThomas Gubler <thomasgubler@gmail.com>2014-01-05 10:49:16 +0100
commit26af21619b3f2a67c2480872e0f7c14d0572626e (patch)
tree877d065066ef9509b2e11261bd5ade4ef9a56a0d /src/modules/navigator/geofence.cpp
parent819822e1722dc31c0f97b8494c96a6c292b07185 (diff)
downloadpx4-firmware-26af21619b3f2a67c2480872e0f7c14d0572626e.tar.gz
px4-firmware-26af21619b3f2a67c2480872e0f7c14d0572626e.tar.bz2
px4-firmware-26af21619b3f2a67c2480872e0f7c14d0572626e.zip
navigator/geofence: add parameter to disable geofence
Diffstat (limited to 'src/modules/navigator/geofence.cpp')
-rw-r--r--src/modules/navigator/geofence.cpp15
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();
+}