Skip to content

Commit cd7128c

Browse files
rubenp02DonLakeFlyer
authored andcommitted
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. This option can be disabled to avoid overly frequent confirmation requests, as accidental triggers are rare. A confirmation is always required if the vehicle is not already in Guided/Go To mode. The option is enabled by default to match the previous behavior behavior of always requiring confirmation.
1 parent 89ced2d commit cd7128c

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

src/FlightDisplay/FlyViewMap.qml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,13 @@ FlightMap {
702702
onClicked: {
703703
mapClickDropPanel.close()
704704
gotoLocationItem.show(mapClickCoord)
705-
globals.guidedControllerFlyView.confirmAction(globals.guidedControllerFlyView.actionGoto, mapClickCoord, gotoLocationItem)
705+
706+
if ((_activeVehicle.flightMode == _activeVehicle.gotoFlightMode) && !_flyViewSettings.goToLocationRequiresConfirmInGuided.value) {
707+
globals.guidedControllerFlyView.executeAction(globals.guidedControllerFlyView.actionGoto, mapClickCoord, gotoLocationItem)
708+
gotoLocationItem.actionConfirmed() // Still need to call this to commit the new coordinate and radius
709+
} else {
710+
globals.guidedControllerFlyView.confirmAction(globals.guidedControllerFlyView.actionGoto, mapClickCoord, gotoLocationItem)
711+
}
706712
}
707713
}
708714

src/Settings/FlyView.SettingsGroup.json

Lines changed: 6 additions & 0 deletions
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": true
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ SettingsPage {
3636
property Fact _guidedMaximumAltitude: _flyViewSettings.guidedMaximumAltitude
3737
property Fact _maxGoToLocationDistance: _flyViewSettings.maxGoToLocationDistance
3838
property Fact _forwardFlightGoToLocationLoiterRad: _flyViewSettings.forwardFlightGoToLocationLoiterRad
39+
property Fact _goToLocationRequiresConfirmInGuided: _flyViewSettings.goToLocationRequiresConfirmInGuided
3940
property var _viewer3DSettings: _settingsManager.viewer3DSettings
4041
property Fact _viewer3DEnabled: _viewer3DSettings.enabled
4142
property Fact _viewer3DOsmFilePath: _viewer3DSettings.osmFilePath
@@ -117,7 +118,8 @@ SettingsPage {
117118
Layout.fillWidth: true
118119
heading: qsTr("Guided Commands")
119120
visible: _guidedMinimumAltitude.visible || _guidedMaximumAltitude.visible ||
120-
_maxGoToLocationDistance.visible || _forwardFlightGoToLocationLoiterRad.visible
121+
_maxGoToLocationDistance.visible || _forwardFlightGoToLocationLoiterRad.visible ||
122+
_goToLocationRequiresConfirmInGuided.visible
121123

122124
LabelledFactTextField {
123125
Layout.fillWidth: true

0 commit comments

Comments
 (0)