Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/FlightDisplay/FlyViewWidgetLayer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ Item {

property real bottomEdgeLeftInset: parent.height-y
property bool autoCenterThrottle: QGroundControl.settingsManager.appSettings.virtualJoystickAutoCenterThrottle.rawValue
property bool leftHandedMode: QGroundControl.settingsManager.appSettings.virtualJoystickLeftHandedMode.rawValue
property bool _virtualJoystickEnabled: QGroundControl.settingsManager.appSettings.virtualJoystick.rawValue
property real bottomEdgeRightInset: parent.height-y
property var _pipViewMargin: _pipView.visible ? parentToolInsets.bottomEdgeLeftInset + ScreenTools.defaultFontPixelHeight * 2 :
Expand Down
6 changes: 4 additions & 2 deletions src/FlightDisplay/VirtualJoystick.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import QGroundControl.Vehicle
Item {
// The following properties must be passed in from the Loader
// property bool autoCenterThrottle - true: throttle will snap back to center when released
// property bool leftHandedMode - true: virtual joystick layout will be reversed

id: virtualJoysticks

Expand All @@ -33,7 +34,7 @@ Item {
repeat: true
onTriggered: {
if (_activeVehicle && _initialConnectComplete) {
_activeVehicle.virtualTabletJoystickValue(rightStick.xAxis, rightStick.yAxis, leftStick.xAxis, leftStick.yAxis)
leftHandedMode ? _activeVehicle.virtualTabletJoystickValue(leftStick.xAxis, leftStick.yAxis, rightStick.xAxis, rightStick.yAxis) : _activeVehicle.virtualTabletJoystickValue(rightStick.xAxis, rightStick.yAxis, leftStick.xAxis, leftStick.yAxis)
}
leftYAxisValue = leftStick.yAxis // We keep Y axis value from the throttle stick for using it while there is a resize
}
Expand Down Expand Up @@ -72,7 +73,7 @@ Item {
anchors.bottom: parent.bottom
width: parent.height
height: parent.height
yAxisPositiveRangeOnly: _activeVehicle && !_activeVehicle.rover
yAxisPositiveRangeOnly: _activeVehicle && !_activeVehicle.rover && !leftHandedMode
yAxisReCenter: autoCenterThrottle
}

Expand All @@ -84,6 +85,7 @@ Item {
anchors.bottom: parent.bottom
width: parent.height
height: parent.height
yAxisPositiveRangeOnly: _activeVehicle && !_activeVehicle.rover && leftHandedMode
yAxisReCenter: true
}
}
7 changes: 7 additions & 0 deletions src/Settings/App.SettingsGroup.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@
"type": "bool",
"default": true
},
{
"name": "virtualJoystickLeftHandedMode",
"shortDesc": "Left Handed Mode",
"longDesc": "If this option is enabled the virtual joystick layout will be reversed",
"type": "bool",
"default": false
},
{
"name": "gstDebugLevel",
"shortDesc": "Video streaming debug",
Expand Down
1 change: 1 addition & 0 deletions src/Settings/AppSettings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ DECLARE_SETTINGSFACT(AppSettings, telemetrySaveNotArmed)
DECLARE_SETTINGSFACT(AppSettings, audioMuted)
DECLARE_SETTINGSFACT(AppSettings, virtualJoystick)
DECLARE_SETTINGSFACT(AppSettings, virtualJoystickAutoCenterThrottle)
DECLARE_SETTINGSFACT(AppSettings, virtualJoystickLeftHandedMode)
DECLARE_SETTINGSFACT(AppSettings, appFontPointSize)
DECLARE_SETTINGSFACT(AppSettings, showLargeCompass)
DECLARE_SETTINGSFACT(AppSettings, savePath)
Expand Down
1 change: 1 addition & 0 deletions src/Settings/AppSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class AppSettings : public SettingsGroup
DEFINE_SETTINGFACT(audioMuted)
DEFINE_SETTINGFACT(virtualJoystick)
DEFINE_SETTINGFACT(virtualJoystickAutoCenterThrottle)
DEFINE_SETTINGFACT(virtualJoystickLeftHandedMode)
DEFINE_SETTINGFACT(appFontPointSize)
DEFINE_SETTINGFACT(indoorPalette)
DEFINE_SETTINGFACT(showLargeCompass)
Expand Down
11 changes: 10 additions & 1 deletion src/UI/preferences/FlyViewSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ SettingsPage {
property var _customMavlinkActionsSettings: _settingsManager.customMavlinkActionsSettings
property Fact _virtualJoystick: _settingsManager.appSettings.virtualJoystick
property Fact _virtualJoystickAutoCenterThrottle: _settingsManager.appSettings.virtualJoystickAutoCenterThrottle
property Fact _virtualJoystickLeftHandedMode: _settingsManager.appSettings.virtualJoystickLeftHandedMode
property Fact _showAdditionalIndicatorsCompass: _flyViewSettings.showAdditionalIndicatorsCompass
property Fact _lockNoseUpCompass: _flyViewSettings.lockNoseUpCompass
property Fact _guidedMinimumAltitude: _flyViewSettings.guidedMinimumAltitude
Expand Down Expand Up @@ -163,7 +164,7 @@ SettingsPage {
SettingsGroupLayout {
Layout.fillWidth: true
heading: qsTr("Virtual Joystick")
visible: _virtualJoystick.visible || _virtualJoystickAutoCenterThrottle.visible
visible: _virtualJoystick.visible || _virtualJoystickAutoCenterThrottle.visible || _virtualJoystickLeftHandedMode.visible

FactCheckBoxSlider {
Layout.fillWidth: true
Expand All @@ -179,6 +180,14 @@ SettingsPage {
enabled: _virtualJoystick.rawValue
fact: _virtualJoystickAutoCenterThrottle
}

FactCheckBoxSlider {
Layout.fillWidth: true
text: qsTr("Left-Handed Mode")
visible: _virtualJoystickLeftHandedMode.visible
enabled: _virtualJoystick.rawValue
fact: _virtualJoystickLeftHandedMode
}
}

SettingsGroupLayout {
Expand Down