Unverified Commit 0c60f8b3 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #7685 from DonLakeFlyer/GoToMaxDistance

Configurable Go To Location max distance
parents da6b87e1 a3480370
......@@ -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.")
......
......@@ -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
}
]
......@@ -21,3 +21,4 @@ DECLARE_SETTINGSFACT(FlyViewSettings, guidedMinimumAltitude)
DECLARE_SETTINGSFACT(FlyViewSettings, guidedMaximumAltitude)
DECLARE_SETTINGSFACT(FlyViewSettings, showLogReplayStatusBar)
DECLARE_SETTINGSFACT(FlyViewSettings, alternateInstrumentPanel)
DECLARE_SETTINGSFACT(FlyViewSettings, maxGoToLocationDistance)
......@@ -23,4 +23,5 @@ public:
DEFINE_SETTINGFACT(guidedMaximumAltitude)
DEFINE_SETTINGFACT(showLogReplayStatusBar)
DEFINE_SETTINGFACT(alternateInstrumentPanel)
DEFINE_SETTINGFACT(maxGoToLocationDistance)
};
......@@ -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);
......
......@@ -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
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment