From d5dc4f1af17151d7e7f88372847bc12ac499ccb9 Mon Sep 17 00:00:00 2001 From: DonLakeFlyer Date: Wed, 7 Jul 2021 10:59:32 -0700 Subject: [PATCH] Fix switch mapping parameter names --- src/AutoPilotPlugins/PX4/PX4SimpleFlightModes.qml | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/AutoPilotPlugins/PX4/PX4SimpleFlightModes.qml b/src/AutoPilotPlugins/PX4/PX4SimpleFlightModes.qml index b55ad33..530ae88 100644 --- a/src/AutoPilotPlugins/PX4/PX4SimpleFlightModes.qml +++ b/src/AutoPilotPlugins/PX4/PX4SimpleFlightModes.qml @@ -21,30 +21,23 @@ import QGroundControl.ScreenTools 1.0 Item { id: root - property real _margins: ScreenTools.defaultFontPixelHeight / 2 - property var _switchNameList: [ "ACRO", "ARM", "GEAR", "KILL", "LOITER", "OFFB", "POSCTL", "RATT", "RETURN", "STAB" ] - property var _switchFactList: [ ] - property var _switchTHFactList: [ ] + property real _margins: ScreenTools.defaultFontPixelHeight / 2 + property var _switchNameList: [ "RC_MAP_ARM_SW", "RC_MAP_GEAR_SW", "RC_MAP_KILL_SW", "RC_MAP_LOITER_SW", "RC_MAP_OFFB_SW", "RC_MAP_RETURN_SW" ] + property var _switchTHList: [ "RC_ARMSWITCH_TH", "RC_GEAR_TH", "RC_KILLSWITCH_TH", "RC_LOITER_TH", "RC_OFFB_TH", "RC_RETURN_TH" ] readonly property real _flightModeComboWidth: ScreenTools.defaultFontPixelWidth * 13 readonly property real _channelComboWidth: ScreenTools.defaultFontPixelWidth * 13 Component.onCompleted: { - if (controller.vehicle.fixedWing) { - _switchNameList.push("MAN") - } if (controller.vehicle.vtol) { - _switchNameList.push("TRANS") - } - for (var i=0; i<_switchNameList.length; i++) { - _switchFactList.push("RC_MAP_" + _switchNameList[i] + "_SW") - _switchTHFactList.push("RC_" + _switchNameList[i] + "_TH") + _switchNameList.push("RC_MAP_TRANS_SW") + _switchTHList.push("RC_TRANS_TH") } if (controller.vehicle.fixedWing) { _switchFactList.push("RC_MAP_FLAPS") _switchTHFactList.push("") } - switchRepeater.model = _switchFactList + switchRepeater.model = _switchNameList } PX4SimpleFlightModesController { @@ -157,8 +150,8 @@ Item { spacing: ScreenTools.defaultFontPixelWidth Layout.fillWidth: true - property string thFactName: _switchTHFactList[index] - property bool thFactExists: thFactName == "" + property string thFactName: _switchTHList[index] + property bool thFactExists: thFactName !== "" property Fact swFact: controller.getParameterFact(-1, modelData) property Fact thFact: thFactExists ? controller.getParameterFact(-1, thFactName) : null property real thValue: thFactExists ? thFact.rawValue : 0.5