geofence: disable altitude check if not configured

It currently cannot be configured via mavlink mission protocol.
This commit is contained in:
Beat Küng 2017-03-27 18:13:05 +02:00 committed by Lorenz Meier
parent 2981ece921
commit 4c1328483d
1 changed files with 4 additions and 2 deletions

View File

@ -260,8 +260,10 @@ bool Geofence::checkPolygons(double lat, double lon, float altitude)
}
/* Vertical check */
if (altitude > _altitude_max || altitude < _altitude_min) {
return false;
if (_altitude_max > _altitude_min) { // only enable vertical check if configured properly
if (altitude > _altitude_max || altitude < _altitude_min) {
return false;
}
}
/* Horizontal check: iterate all polygons */