Skip to content

Commit f697afa

Browse files
committed
Add Go to confirmation option to Fly View settings
Added a Fly View setting to require confirmation for the "Go to location" action when in Guided/Go To mode. The option is disabled by default to avoid constant confirmation requests, as accidental triggers are rare. However, a confirmation is always required if the vehicle is not already in Guided/Go To mode. Enabling this setting restores the previous behavior of always requiring confirmation.
1 parent 3a75a8c commit f697afa

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

src/FlightDisplay/FlyViewMap.qml

+7-1
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,13 @@ FlightMap {
712712
onClicked: {
713713
mapClickDropPanel.close()
714714
gotoLocationItem.show(mapClickCoord)
715-
globals.guidedControllerFlyView.confirmAction(globals.guidedControllerFlyView.actionGoto, mapClickCoord, gotoLocationItem)
715+
716+
if ((_activeVehicle.flightMode == _activeVehicle.gotoFlightMode) && !_flyViewSettings.goToLocationRequiresConfirmInGuided.value) {
717+
globals.guidedControllerFlyView.executeAction(globals.guidedControllerFlyView.actionGoto, mapClickCoord, gotoLocationItem)
718+
gotoLocationItem.actionConfirmed() // Still need to call this to commit the new coordinate and radius
719+
} else {
720+
globals.guidedControllerFlyView.confirmAction(globals.guidedControllerFlyView.actionGoto, mapClickCoord, gotoLocationItem)
721+
}
716722
}
717723
}
718724

src/Settings/FlyView.SettingsGroup.json

+6
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@
6969
"default": 80,
7070
"min": 25
7171
},
72+
{
73+
"name": "goToLocationRequiresConfirmInGuided",
74+
"shortDesc": "Require slide confirmation for Go To Location when the vehicle is already in Guided mode.",
75+
"type": "bool",
76+
"default": false
77+
},
7278
{
7379
"name": "updateHomePosition",
7480
"shortDesc": "Send updated GCS' home position to autopilot in case of change of the home position",

src/Settings/FlyViewSettings.cc

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ DECLARE_SETTINGSFACT(FlyViewSettings, showAdditionalIndicatorsCompass)
2323
DECLARE_SETTINGSFACT(FlyViewSettings, lockNoseUpCompass)
2424
DECLARE_SETTINGSFACT(FlyViewSettings, maxGoToLocationDistance)
2525
DECLARE_SETTINGSFACT(FlyViewSettings, forwardFlightGoToLocationLoiterRad)
26+
DECLARE_SETTINGSFACT(FlyViewSettings, goToLocationRequiresConfirmInGuided)
2627
DECLARE_SETTINGSFACT(FlyViewSettings, keepMapCenteredOnVehicle)
2728
DECLARE_SETTINGSFACT(FlyViewSettings, showSimpleCameraControl)
2829
DECLARE_SETTINGSFACT(FlyViewSettings, showObstacleDistanceOverlay)

src/Settings/FlyViewSettings.h

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class FlyViewSettings : public SettingsGroup
2626
DEFINE_SETTINGFACT(lockNoseUpCompass)
2727
DEFINE_SETTINGFACT(maxGoToLocationDistance)
2828
DEFINE_SETTINGFACT(forwardFlightGoToLocationLoiterRad)
29+
DEFINE_SETTINGFACT(goToLocationRequiresConfirmInGuided)
2930
DEFINE_SETTINGFACT(keepMapCenteredOnVehicle)
3031
DEFINE_SETTINGFACT(showSimpleCameraControl)
3132
DEFINE_SETTINGFACT(showObstacleDistanceOverlay)

src/UI/preferences/FlyViewSettings.qml

+3-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ SettingsPage {
3535
property Fact _guidedMaximumAltitude: _flyViewSettings.guidedMaximumAltitude
3636
property Fact _maxGoToLocationDistance: _flyViewSettings.maxGoToLocationDistance
3737
property Fact _forwardFlightGoToLocationLoiterRad: _flyViewSettings.forwardFlightGoToLocationLoiterRad
38+
property Fact _goToLocationRequiresConfirmInGuided: _flyViewSettings.goToLocationRequiresConfirmInGuided
3839
property var _viewer3DSettings: _settingsManager.viewer3DSettings
3940
property Fact _viewer3DEnabled: _viewer3DSettings.enabled
4041
property Fact _viewer3DOsmFilePath: _viewer3DSettings.osmFilePath
@@ -116,7 +117,8 @@ SettingsPage {
116117
Layout.fillWidth: true
117118
heading: qsTr("Guided Commands")
118119
visible: _guidedMinimumAltitude.visible || _guidedMaximumAltitude.visible ||
119-
_maxGoToLocationDistance.visible || _forwardFlightGoToLocationLoiterRad.visible
120+
_maxGoToLocationDistance.visible || _forwardFlightGoToLocationLoiterRad.visible ||
121+
_goToLocationRequiresConfirmInGuided.visible
120122

121123
LabelledFactTextField {
122124
Layout.fillWidth: true

0 commit comments

Comments
 (0)