Commit a3480370 authored by Don Gagne's avatar Don Gagne

parent d73fc45e
...@@ -49,7 +49,7 @@ Item { ...@@ -49,7 +49,7 @@ Item {
readonly property string orbitTitle: qsTr("Orbit") readonly property string orbitTitle: qsTr("Orbit")
readonly property string landAbortTitle: qsTr("Land Abort") readonly property string landAbortTitle: qsTr("Land Abort")
readonly property string setWaypointTitle: qsTr("Set Waypoint") 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 vtolTransitionTitle: qsTr("VTOL Transition")
readonly property string armMessage: qsTr("Arm the vehicle.") readonly property string armMessage: qsTr("Arm the vehicle.")
......
...@@ -24,5 +24,13 @@ ...@@ -24,5 +24,13 @@
"shortDescription": "Use Vertical Instrument Panel instead of the default one", "shortDescription": "Use Vertical Instrument Panel instead of the default one",
"type": "bool", "type": "bool",
"defaultValue": false "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) ...@@ -21,3 +21,4 @@ DECLARE_SETTINGSFACT(FlyViewSettings, guidedMinimumAltitude)
DECLARE_SETTINGSFACT(FlyViewSettings, guidedMaximumAltitude) DECLARE_SETTINGSFACT(FlyViewSettings, guidedMaximumAltitude)
DECLARE_SETTINGSFACT(FlyViewSettings, showLogReplayStatusBar) DECLARE_SETTINGSFACT(FlyViewSettings, showLogReplayStatusBar)
DECLARE_SETTINGSFACT(FlyViewSettings, alternateInstrumentPanel) DECLARE_SETTINGSFACT(FlyViewSettings, alternateInstrumentPanel)
DECLARE_SETTINGSFACT(FlyViewSettings, maxGoToLocationDistance)
...@@ -23,4 +23,5 @@ public: ...@@ -23,4 +23,5 @@ public:
DEFINE_SETTINGFACT(guidedMaximumAltitude) DEFINE_SETTINGFACT(guidedMaximumAltitude)
DEFINE_SETTINGFACT(showLogReplayStatusBar) DEFINE_SETTINGFACT(showLogReplayStatusBar)
DEFINE_SETTINGFACT(alternateInstrumentPanel) DEFINE_SETTINGFACT(alternateInstrumentPanel)
DEFINE_SETTINGFACT(maxGoToLocationDistance)
}; };
...@@ -3041,9 +3041,9 @@ void Vehicle::guidedModeGotoLocation(const QGeoCoordinate& gotoCoord) ...@@ -3041,9 +3041,9 @@ void Vehicle::guidedModeGotoLocation(const QGeoCoordinate& gotoCoord)
if (!coordinate().isValid()) { if (!coordinate().isValid()) {
return; return;
} }
double maxDistance = 10000.0; double maxDistance = _settingsManager->flyViewSettings()->maxGoToLocationDistance()->rawValue().toDouble();
if (coordinate().distanceTo(gotoCoord) > maxDistance) { 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; return;
} }
_firmwarePlugin->guidedModeGotoLocation(this, gotoCoord); _firmwarePlugin->guidedModeGotoLocation(this, gotoCoord);
......
...@@ -479,16 +479,38 @@ Rectangle { ...@@ -479,16 +479,38 @@ Rectangle {
GridLayout { GridLayout {
columns: 2 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 { FactTextField {
Layout.preferredWidth: _valueFieldWidth 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 { FactTextField {
Layout.preferredWidth: _valueFieldWidth 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