Skip to content

Commit

Permalink
Add support for flight mode change confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
DonLakeFlyer committed Aug 21, 2024
1 parent eefb814 commit 7ae81aa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/FlightDisplay/GuidedActionsController.qml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Item {
readonly property string setHomeTitle: qsTr("Set Home")
readonly property string actionListTitle: qsTr("Action")
readonly property string setEstimatorOriginTitle: qsTr("Set Estimator origin")
readonly property string setFlightMode: qsTr("Set Flight Mode")

readonly property string armMessage: qsTr("Arm the vehicle.")
readonly property string forceArmMessage: qsTr("WARNING: This will force arming of the vehicle bypassing any safety checks.")
Expand All @@ -84,6 +85,7 @@ Item {
readonly property string roiMessage: qsTr("Make the specified location a Region Of Interest.")
readonly property string setHomeMessage: qsTr("Set vehicle home as the specified location. This will affect Return to Home position")
readonly property string setEstimatorOriginMessage: qsTr("Make the specified location the estimator origin.")
readonly property string setFlightModeMessage: qsTr("Set the vehicle flight mode to %1").arg(_actionData)

readonly property int actionRTL: 1
readonly property int actionLand: 2
Expand Down Expand Up @@ -113,8 +115,8 @@ Item {
readonly property int actionGripper: 26
readonly property int actionSetHome: 27
readonly property int actionSetEstimatorOrigin: 28
readonly property int actionSetFlightMode: 29


property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property var _flyViewSettings: QGroundControl.settingsManager.flyViewSettings
property var _unitsConversion: QGroundControl.unitsConversion
Expand Down Expand Up @@ -538,6 +540,10 @@ Item {
confirmDialog.title = setEstimatorOriginTitle
confirmDialog.message = setEstimatorOriginMessage
break
case actionSetFlightMode:
confirmDialog.title = setFlightMode
confirmDialog.message = setFlightModeMessage
break
default:
console.warn("Unknown actionCode", actionCode)
return
Expand Down Expand Up @@ -644,6 +650,9 @@ Item {
case actionSetEstimatorOrigin:
_activeVehicle.setEstimatorOrigin(actionData)
break
case actionSetFlightMode:
_activeVehicle.flightMode = actionData
break
default:
console.warn(qsTr("Internal error: unknown actionCode"), actionCode)
break
Expand Down
3 changes: 2 additions & 1 deletion src/UI/toolbar/FlightModeIndicator.qml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ RowLayout {
parent.children[1].toggle()
parent.children[1].clicked()
} else {
activeVehicle.flightMode = modelData
var controller = globals.guidedControllerFlyView
controller.confirmAction(controller.actionSetFlightMode, modelData)
mainWindow.closeIndicatorDrawer()
}
}
Expand Down

0 comments on commit 7ae81aa

Please sign in to comment.