6import QGroundControl.FactControls
7import QGroundControl.Controls
11 pageComponent: flightModePageComponent
13 readonly property string _modeChannelParam: controller.modeChannelParam
14 readonly property string _modeParamPrefix: controller.modeParamPrefix
15 readonly property var _pwmStrings: [ "PWM 0 - 1230", "PWM 1231 - 1360", "PWM 1361 - 1490", "PWM 1491 - 1620", "PWM 1621 - 1749", "PWM 1750 +"]
17 property real _margins: ScreenTools.defaultFontPixelHeight
18 property Fact _nullFact
19 property bool _fltmodeChExists: controller.parameterExists(-1, _modeChannelParam)
20 property Fact _fltmodeCh: _fltmodeChExists ? controller.getParameterFact(-1, _modeChannelParam) : _nullFact
21 property bool _ch7OptAvailable: controller.parameterExists(-1, "CH7_OPT")
22 property int _rcOptionStart: _ch7OptAvailable ? 7 : 6
23 property int _rcOptionStop: _ch7OptAvailable ? 12 : 16
24 property bool _customSimpleMode: controller.simpleMode === APMFlightModesComponentController.SimpleModeCustom
26 QGCPalette { id: qgcPal; colorGroupEnabled: true }
28 APMFlightModesComponentController {
33 id: flightModePageComponent
45 text: qsTr("Flight Mode Settings") + (_fltmodeChExists ? "" : qsTr(" (Channel 5)"))
50 id: flightModeSettings
51 width: flightModeColumn.width + (_margins * 2)
52 height: flightModeColumn.height + ScreenTools.defaultFontPixelHeight
53 color: qgcPal.windowShade
57 anchors.margins: ScreenTools.defaultFontPixelWidth
58 anchors.left: parent.left
59 anchors.top: parent.top
60 spacing: ScreenTools.defaultFontPixelHeight
64 visible: _fltmodeChExists
68 anchors.baseline: modeChannelCombo.baseline
69 text: qsTr("Flight mode channel:")
74 width: ScreenTools.defaultFontPixelWidth * 15
75 model: [ qsTr("Not assigned"), qsTr("Channel 1"), qsTr("Channel 2"),
76 qsTr("Channel 3"), qsTr("Channel 4"), qsTr("Channel 5"),
77 qsTr("Channel 6"), qsTr("Channel 7"), qsTr("Channel 8") ]
79 currentIndex: _fltmodeCh.value
80 onActivated: (index) => { _fltmodeCh.value = index }
85 rows: _customSimpleMode ? 7 : 6
86 flow: GridLayout.TopToBottom
88 QGCLabel { text: ""; visible: _customSimpleMode }
93 text: qsTr("Flight Mode ") + index
94 color: controller.activeFlightMode == index ? "yellow" : qgcPal.text
96 property int index: modelData + 1
100 QGCLabel { text: ""; visible: _customSimpleMode }
105 Layout.preferredWidth: ScreenTools.defaultFontPixelWidth * 15
106 fact: controller.getParameterFact(-1, _modeParamPrefix + index)
109 property int index: modelData + 1
115 font.pointSize: ScreenTools.smallFontPointSize
116 visible: _customSimpleMode
119 model: controller.simpleModeEnabled
121 Layout.alignment: Qt.AlignHCenter
122 visible: _customSimpleMode
124 onClicked: controller.setSimpleMode(index, checked)
129 text: qsTr("Super-Simple")
130 font.pointSize: ScreenTools.smallFontPointSize
131 visible: _customSimpleMode
134 model: controller.superSimpleModeEnabled
136 Layout.alignment: Qt.AlignHCenter
137 visible: _customSimpleMode
139 onClicked: controller.setSuperSimpleMode(index, checked)
143 QGCLabel { text: ""; visible: _customSimpleMode }
147 QGCLabel { text: _pwmStrings[modelData] }
153 visible: controller.simpleModesSupported
155 QGCLabel { text: qsTr("Simple Mode") }
158 model: controller.simpleModeNames
159 currentIndex: controller.simpleMode
160 onActivated: (index) => { controller.simpleMode = index }
163 } // Column - Flight Modes
164 } // Rectangle - Flight Modes
165 } // Column - Flight Modes
171 id: channelOptionsLabel
172 text: qsTr("Switch Options")
177 id: channelOptionsSettings
178 width: channelOptColumn.width + (_margins * 2)
179 height: channelOptColumn.height + ScreenTools.defaultFontPixelHeight
180 color: qgcPal.windowShade
184 anchors.margins: ScreenTools.defaultFontPixelWidth
185 anchors.left: parent.left
186 anchors.top: parent.top
187 spacing: ScreenTools.defaultFontPixelHeight
190 model: _rcOptionStop - _rcOptionStart + 1
193 spacing: ScreenTools.defaultFontPixelWidth
195 property int index: modelData + _rcOptionStart
196 property Fact nullFact: Fact { }
199 anchors.baseline: optCombo.baseline
200 text: qsTr("Channel option %1 :").arg(index)
201 color: controller.channelOptionEnabled[modelData + (_ch7OptAvailable ? 1 : 0)] ? "yellow" : qgcPal.text
206 width: ScreenTools.defaultFontPixelWidth * 15
207 fact: controller.getParameterFact(-1, "r.RC" + index + "_OPTION")
211 } // Repeater -- Channel options
212 } // Column - Channel options
213 } // Rectangle - Channel options
214 } // Column - Channel options
216 } // Component - flightModePageComponent