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 real _comboWidth: ScreenTools.defaultFontPixelWidth * 30
19 property Fact _nullFact
20 property bool _fltmodeChExists: controller.parameterExists(-1, _modeChannelParam)
21 property Fact _fltmodeCh: _fltmodeChExists ? controller.getParameterFact(-1, _modeChannelParam) : _nullFact
22 property bool _ch7OptAvailable: controller.parameterExists(-1, "CH7_OPT")
23 property int _rcOptionStart: _ch7OptAvailable ? 7 : 6
24 property int _rcOptionStop: _ch7OptAvailable ? 12 : 16
25 property bool _customSimpleMode: controller.simpleMode === APMFlightModesComponentController.SimpleModeCustom
27 QGCPalette { id: qgcPal; colorGroupEnabled: true }
29 APMFlightModesComponentController {
34 id: flightModePageComponent
42 title: qsTr("Flight Mode Settings") + (_fltmodeChExists ? "" : qsTr(" (Channel 5)"))
45 spacing: ScreenTools.defaultFontPixelHeight
49 visible: _fltmodeChExists
53 anchors.baseline: modeChannelCombo.baseline
54 text: qsTr("Flight mode channel:")
60 Layout.maximumWidth: _comboWidth
61 model: [ qsTr("Not assigned"), qsTr("Channel 1"), qsTr("Channel 2"),
62 qsTr("Channel 3"), qsTr("Channel 4"), qsTr("Channel 5"),
63 qsTr("Channel 6"), qsTr("Channel 7"), qsTr("Channel 8") ]
65 currentIndex: _fltmodeCh.value
66 onActivated: (index) => { _fltmodeCh.value = index }
71 rows: _customSimpleMode ? 7 : 6
72 flow: GridLayout.TopToBottom
74 QGCLabel { text: ""; visible: _customSimpleMode }
79 text: qsTr("Flight Mode ") + index
80 color: controller.activeFlightMode == index ? "yellow" : qgcPal.text
82 property int index: modelData + 1
86 QGCLabel { text: ""; visible: _customSimpleMode }
92 Layout.maximumWidth: _comboWidth
93 fact: controller.getParameterFact(-1, _modeParamPrefix + index)
96 property int index: modelData + 1
102 font.pointSize: ScreenTools.smallFontPointSize
103 visible: _customSimpleMode
106 model: controller.simpleModeEnabled
108 Layout.alignment: Qt.AlignHCenter
109 visible: _customSimpleMode
111 onClicked: controller.setSimpleMode(index, checked)
116 text: qsTr("Super-Simple")
117 font.pointSize: ScreenTools.smallFontPointSize
118 visible: _customSimpleMode
121 model: controller.superSimpleModeEnabled
123 Layout.alignment: Qt.AlignHCenter
124 visible: _customSimpleMode
126 onClicked: controller.setSuperSimpleMode(index, checked)
130 QGCLabel { text: ""; visible: _customSimpleMode }
134 QGCLabel { text: _pwmStrings[modelData] }
140 visible: controller.simpleModesSupported
142 QGCLabel { text: qsTr("Simple Mode") }
145 model: controller.simpleModeNames
146 currentIndex: controller.simpleMode
147 onActivated: (index) => { controller.simpleMode = index }
151 } // QGCGroupBox - Flight Modes
154 title: qsTr("Switch Options")
157 spacing: ScreenTools.defaultFontPixelHeight
160 model: _rcOptionStop - _rcOptionStart + 1
163 spacing: ScreenTools.defaultFontPixelWidth
165 property int index: modelData + _rcOptionStart
166 property Fact nullFact: Fact { }
169 anchors.baseline: optCombo.baseline
170 text: qsTr("Channel option %1 :").arg(index)
171 color: controller.channelOptionEnabled[modelData + (_ch7OptAvailable ? 1 : 0)] ? "yellow" : qgcPal.text
177 Layout.maximumWidth: _comboWidth
178 fact: controller.getParameterFact(-1, "RC" + index + "_OPTION")
182 } // Repeater -- Channel options
184 } // QGCGroupBox - Channel options
186 } // Component - flightModePageComponent