navigator/geofence: add parameter to disable geofence

This commit is contained in:
Thomas Gubler
2014-01-05 10:49:16 +01:00
parent 819822e172
commit 26af21619b
5 changed files with 78 additions and 3 deletions
+13 -2
View File
@@ -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();
}