Browse Source

Configurable Go To Location max distance

QGC4.4
Don Gagne 6 years ago
parent
commit
a3480370bb
  1. 2
      src/FlightDisplay/GuidedActionsController.qml
  2. 8
      src/Settings/FlyView.SettingsGroup.json
  3. 1
      src/Settings/FlyViewSettings.cc
  4. 1
      src/Settings/FlyViewSettings.h
  5. 4
      src/Vehicle/Vehicle.cc
  6. 30
      src/ui/preferences/GeneralSettings.qml

2
src/FlightDisplay/GuidedActionsController.qml

@ -49,7 +49,7 @@ Item { @@ -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.")

8
src/Settings/FlyView.SettingsGroup.json

@ -24,5 +24,13 @@ @@ -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
}
]

1
src/Settings/FlyViewSettings.cc

@ -21,3 +21,4 @@ DECLARE_SETTINGSFACT(FlyViewSettings, guidedMinimumAltitude) @@ -21,3 +21,4 @@ DECLARE_SETTINGSFACT(FlyViewSettings, guidedMinimumAltitude)
DECLARE_SETTINGSFACT(FlyViewSettings, guidedMaximumAltitude)
DECLARE_SETTINGSFACT(FlyViewSettings, showLogReplayStatusBar)
DECLARE_SETTINGSFACT(FlyViewSettings, alternateInstrumentPanel)
DECLARE_SETTINGSFACT(FlyViewSettings, maxGoToLocationDistance)

1
src/Settings/FlyViewSettings.h

@ -23,4 +23,5 @@ public: @@ -23,4 +23,5 @@ public:
DEFINE_SETTINGFACT(guidedMaximumAltitude)
DEFINE_SETTINGFACT(showLogReplayStatusBar)
DEFINE_SETTINGFACT(alternateInstrumentPanel)
DEFINE_SETTINGFACT(maxGoToLocationDistance)
};

4
src/Vehicle/Vehicle.cc

@ -3041,9 +3041,9 @@ void Vehicle::guidedModeGotoLocation(const QGeoCoordinate& gotoCoord) @@ -3041,9 +3041,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);

30
src/ui/preferences/GeneralSettings.qml

@ -479,16 +479,38 @@ Rectangle { @@ -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
}
}
}

Loading…
Cancel
Save