From 8bb1b5edd12b467af1576f50b10378ae238f5bd9 Mon Sep 17 00:00:00 2001 From: DonLakeFlyer Date: Tue, 2 May 2017 11:52:28 -0700 Subject: [PATCH] Max goto location of 1km --- src/Vehicle/Vehicle.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index db8b9bec7..d68d6db7c 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -2024,6 +2024,14 @@ void Vehicle::guidedModeGotoLocation(const QGeoCoordinate& gotoCoord) qgcApp()->showMessage(guided_mode_not_supported_by_vehicle); return; } + if (!coordinate().isValid()) { + return; + } + double maxDistance = 1000.0; + if (coordinate().distanceTo(gotoCoord) > maxDistance) { + qgcApp()->showMessage(QString("New location is too far. Must be less than %1 %2").arg(qRound(FactMetaData::metersToAppSettingsDistanceUnits(maxDistance).toDouble())).arg(FactMetaData::appSettingsDistanceUnitsString())); + return; + } _firmwarePlugin->guidedModeGotoLocation(this, gotoCoord); } -- 2.22.0