6import QGroundControl.FactControls
7import QGroundControl.Controls
10 pageComponent: pageComponent
17 height: availableHeight
19 property string sectionNameFilter: ""
21 property real _margins: ScreenTools.defaultFontPixelHeight / 2
22 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" ]
23 property var _switchTHList: [ "RC_ARMSWITCH_TH", "RC_GEAR_TH", "RC_KILLSWITCH_TH", "RC_LOITER_TH", "RC_OFFB_TH", "RC_RETURN_TH" ]
25 readonly property real _channelComboWidth: ScreenTools.defaultFontPixelWidth * 13
27 Component.onCompleted: {
28 if (controller.vehicle.vtol) {
29 _switchNameList.push("RC_MAP_TRANS_SW")
30 _switchTHList.push("RC_TRANS_TH")
32 if (controller.vehicle.fixedWing) {
33 _switchNameList.push("RC_MAP_FLAPS")
34 _switchTHList.push("")
36 switchRepeater.model = _switchNameList
39 PX4SimpleFlightModesController {
46 contentWidth: column2.x + column2.width
47 contentHeight: Math.max(column1.height, column2.height)
58 id: flightModeSettingsColumn
60 visible: sectionNameFilter === "" || sectionNameFilter === qsTr("Flight Modes")
64 text: qsTr("Flight Mode Settings")
69 id: flightModeSettings
70 width: flightModeColumn.width + (_margins * 2)
71 height: flightModeColumn.height + ScreenTools.defaultFontPixelHeight
72 color: qgcPal.windowShade
76 anchors.margins: ScreenTools.defaultFontPixelWidth
77 anchors.left: parent.left
78 anchors.top: parent.top
80 rowSpacing: ScreenTools.defaultFontPixelWidth / 2
81 columnSpacing: rowSpacing
82 flow: GridLayout.TopToBottom
85 Layout.fillWidth: true
86 text: qsTr("Mode Channel")
93 Layout.fillWidth: true
94 text: qsTr("Flight Mode %1").arg(modelData + 1)
95 color: (controller.activeFlightMode - 1) == index ? "yellow" : qgcPal.text
100 Layout.fillWidth: true
101 fact: controller.getParameterFact(-1, "RC_MAP_FLTMODE")
110 Layout.fillWidth: true
111 fact: controller.getParameterFact(-1, "COM_FLTMODE" + (modelData + 1))
117 } // Rectangle - Flight Modes
118 } // Column - Flight mode settings
123 visible: sectionNameFilter === "" || sectionNameFilter === qsTr("Switch Settings")
126 text: qsTr("Switch Settings")
131 id: switchSettingsRect
132 width: switchSettingsGrid.width + (_margins * 2)
133 height: switchSettingsGrid.height + ScreenTools.defaultFontPixelHeight
134 color: qgcPal.windowShade
137 id: switchSettingsGrid
138 anchors.margins: ScreenTools.defaultFontPixelWidth
139 anchors.left: parent.left
140 anchors.top: parent.top
142 columnSpacing: ScreenTools.defaultFontPixelWidth
148 spacing: ScreenTools.defaultFontPixelWidth
149 Layout.fillWidth: true
151 property string thFactName: _switchTHList[index]
152 property bool thFactExists: thFactName !== ""
153 property Fact swFact: controller.getParameterFact(-1, modelData)
154 property Fact thFact: thFactExists ? controller.getParameterFact(-1, thFactName) : null
155 property real thValue: thFactExists ? thFact.rawValue : 0.5
156 property real thPWM: 1000 + (1000 * thValue)
157 property int swChannel: swFact.rawValue - 1
158 property bool swActive: swChannel < 0 ?
161 (controller.rcChannelValues[swChannel] > thPWM) :
162 (controller.rcChannelValues[swChannel] <= thPWM))
164 text: swFact.shortDescription
165 Layout.fillWidth: true
166 color: swActive ? "yellow" : qgcPal.text
170 Layout.preferredWidth: _channelComboWidth
180 width: switchSettingsRect.width
183 } // Column - Switch settings