diff --git a/src/FlightDisplay/GuidedActionsController.qml b/src/FlightDisplay/GuidedActionsController.qml index e9afe1a8b88ff3b576e05ed0f5f5f14d8f16daf8..8c0995548f50e339d530a6f012e13e397d46588e 100644 --- a/src/FlightDisplay/GuidedActionsController.qml +++ b/src/FlightDisplay/GuidedActionsController.qml @@ -49,7 +49,7 @@ Item { readonly property string orbitTitle: qsTr("Orbit") readonly property string landAbortTitle: qsTr("Land Abort") readonly property string setWaypointTitle: qsTr("Set Waypoint") - readonly property string gotoTitle: qsTr("Goto Location") + readonly property string gotoTitle: qsTr("Go To Location") readonly property string vtolTransitionTitle: qsTr("VTOL Transition") readonly property string armMessage: qsTr("Arm the vehicle.") diff --git a/src/Settings/FlyView.SettingsGroup.json b/src/Settings/FlyView.SettingsGroup.json index ec456ebdfa7b3483f2868f1f51165b5d54d8cb23..a426507b336cf266b239aa87c2780f410bc00401 100644 --- a/src/Settings/FlyView.SettingsGroup.json +++ b/src/Settings/FlyView.SettingsGroup.json @@ -24,5 +24,13 @@ "shortDescription": "Use Vertical Instrument Panel instead of the default one", "type": "bool", "defaultValue": false +}, +{ + "name": "maxGoToLocationDistance", + "shortDescription": "Maximum distance allowed for Go To Location.", + "type": "double", + "units": "m", + "defaultValue": 1000, + "min": 1 } ] diff --git a/src/Settings/FlyViewSettings.cc b/src/Settings/FlyViewSettings.cc index 2d3d1f8fa2d723d9b2aa7b0e2530bb0e4558f118..603fed613ef6c2dbc4938af8f4765155e0292e2d 100644 --- a/src/Settings/FlyViewSettings.cc +++ b/src/Settings/FlyViewSettings.cc @@ -21,3 +21,4 @@ DECLARE_SETTINGSFACT(FlyViewSettings, guidedMinimumAltitude) DECLARE_SETTINGSFACT(FlyViewSettings, guidedMaximumAltitude) DECLARE_SETTINGSFACT(FlyViewSettings, showLogReplayStatusBar) DECLARE_SETTINGSFACT(FlyViewSettings, alternateInstrumentPanel) +DECLARE_SETTINGSFACT(FlyViewSettings, maxGoToLocationDistance) diff --git a/src/Settings/FlyViewSettings.h b/src/Settings/FlyViewSettings.h index ee12163b25d8949299fcffb5b5ec4958eec37e91..67d4fd5a1c1c45d15a2d098ee247608401a8dc86 100644 --- a/src/Settings/FlyViewSettings.h +++ b/src/Settings/FlyViewSettings.h @@ -23,4 +23,5 @@ public: DEFINE_SETTINGFACT(guidedMaximumAltitude) DEFINE_SETTINGFACT(showLogReplayStatusBar) DEFINE_SETTINGFACT(alternateInstrumentPanel) + DEFINE_SETTINGFACT(maxGoToLocationDistance) }; diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index 79e2115b0a803d68b3afaacfa1d8eb1a2cb8a367..efd7b6fd8cad109c771253a93655377b4a01bb63 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -3046,9 +3046,9 @@ void Vehicle::guidedModeGotoLocation(const QGeoCoordinate& gotoCoord) if (!coordinate().isValid()) { return; } - double maxDistance = 10000.0; + double maxDistance = _settingsManager->flyViewSettings()->maxGoToLocationDistance()->rawValue().toDouble(); 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())); + 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); diff --git a/src/ui/preferences/GeneralSettings.qml b/src/ui/preferences/GeneralSettings.qml index eda8d14c37ae8d21597b8471d215073bc6add64f..8dfd223d61965948bfc9ac68f7ccb677c98763af 100644 --- a/src/ui/preferences/GeneralSettings.qml +++ b/src/ui/preferences/GeneralSettings.qml @@ -479,16 +479,38 @@ Rectangle { GridLayout { columns: 2 - QGCLabel { text: qsTr("Guided Minimum Altitude") } + property Fact _guidedMinimumAltitude: QGroundControl.settingsManager.flyViewSettings.guidedMinimumAltitude + property Fact _guidedMaximumAltitude: QGroundControl.settingsManager.flyViewSettings.guidedMaximumAltitude + property Fact _maxGoToLocationDistance: QGroundControl.settingsManager.flyViewSettings.maxGoToLocationDistance + + QGCLabel { + text: qsTr("Guided Minimum Altitude") + visible: parent._guidedMinimumAltitude.visible + } FactTextField { Layout.preferredWidth: _valueFieldWidth - fact: QGroundControl.settingsManager.flyViewSettings.guidedMinimumAltitude + visible: parent._guidedMinimumAltitude.visible + fact: parent._guidedMinimumAltitude } - QGCLabel { text: qsTr("Guided Maximum Altitude") } + QGCLabel { + text: qsTr("Guided Maximum Altitude") + visible: parent._guidedMaximumAltitude.visible + } + FactTextField { + Layout.preferredWidth: _valueFieldWidth + visible: parent._guidedMaximumAltitude.visible + fact: parent._guidedMaximumAltitude + } + + QGCLabel { + text: qsTr("Go To Location Max Distance") + visible: parent._maxGoToLocationDistance.visible + } FactTextField { Layout.preferredWidth: _valueFieldWidth - fact: QGroundControl.settingsManager.flyViewSettings.guidedMaximumAltitude + visible: parent._maxGoToLocationDistance.visible + fact: parent._maxGoToLocationDistance } } }