6import QGroundControl.FactControls
7import QGroundControl.Controls
12 pageComponent: airspeedPageComponent
15 id: airspeedPageComponent
19 spacing: ScreenTools.defaultFontPixelHeight
21 // Sensor type constants
22 readonly property int _typeNone: 0
23 readonly property int _typeAnalog: 2
24 readonly property int _typeSDP3X: 7
25 readonly property int _typeDroneCAN: 8
26 readonly property int _typeDLVR: 9
27 readonly property int _typeASP5033: 10
28 readonly property int _typeMS5525_Addr1: 11
29 readonly property int _typeMS5525_Addr2: 12
30 readonly property int _typeNMEA: 13
31 readonly property int _typeMSP: 14
32 readonly property int _typeExtAHRS: 16
33 readonly property int _typeSDPx1: 17
34 readonly property int _typeSDPx2: 18
35 readonly property int _typeSDPx3: 19
37 readonly property real _margins: ScreenTools.defaultFontPixelWidth / 2
38 readonly property real _comboWidth: ScreenTools.defaultFontPixelWidth * 30
39 readonly property real _textFieldWidth: ScreenTools.defaultFontPixelWidth * 15
42 readonly property bool _arspdTypeAvailable: controller.parameterExists(-1, "ARSPD_TYPE")
43 readonly property Fact _arspdType: _arspdTypeAvailable ? controller.getParameterFact(-1, "ARSPD_TYPE") : null
44 readonly property int _sensorType: _arspdType ? _arspdType.rawValue : 0
45 readonly property bool _sensorEnabled: _arspdTypeAvailable && _sensorType !== _typeNone
48 readonly property bool _arspd2TypeAvailable: controller.parameterExists(-1, "ARSPD2_TYPE")
49 readonly property Fact _arspd2Type: _arspd2TypeAvailable ? controller.getParameterFact(-1, "ARSPD2_TYPE") : null
50 readonly property int _sensor2Type: _arspd2Type ? _arspd2Type.rawValue : 0
51 readonly property bool _sensor2Enabled: _arspd2TypeAvailable && _sensor2Type !== _typeNone
53 readonly property var _nonI2CTypes: [_typeNone, _typeAnalog, _typeDroneCAN, _typeNMEA, _typeMSP, _typeExtAHRS]
54 readonly property var _nonPitotTypes: [_typeNone, _typeNMEA, _typeMSP, _typeExtAHRS]
56 readonly property var _psiRangeTypes: [_typeSDP3X, _typeDLVR, _typeASP5033, _typeMS5525_Addr1, _typeMS5525_Addr2, _typeSDPx1, _typeSDPx2, _typeSDPx3]
58 function _isAnalog(sType) { return sType === _typeAnalog }
59 function _isI2C(sType) { return _nonI2CTypes.indexOf(sType) === -1 }
60 function _isPitot(sType) { return _nonPitotTypes.indexOf(sType) === -1 }
61 function _hasPsiRange(sType) { return _psiRangeTypes.indexOf(sType) !== -1 }
63 FactPanelController { id: controller }
64 QGCPalette { id: qgcPal; colorGroupEnabled: true }
67 Layout.maximumWidth: availableWidth
76 Layout.fillWidth: true
77 spacing: ScreenTools.defaultFontPixelHeight
79 // ─── Shared Basic Sensor Configuration Component ───
82 id: basicSensorSettingsComponent
87 LabelledFactComboBox {
88 label: qsTr("Sensor type")
91 comboBoxPreferredWidth: _comboWidth
92 Layout.fillWidth: true
97 visible: sensorTypeFact.rawValue !== _typeNone
99 LabelledFactComboBox {
100 label: qsTr("Use airspeed")
101 fact: controller.getParameterFact(-1, paramPrefix + "USE", false)
103 comboBoxPreferredWidth: _comboWidth
104 Layout.fillWidth: true
105 visible: controller.parameterExists(-1, paramPrefix + "USE")
108 LabelledFactTextField {
109 label: qsTr("Airspeed ratio")
110 fact: controller.getParameterFact(-1, paramPrefix + "RATIO", false)
111 textFieldPreferredWidth: _textFieldWidth
112 textFieldShowUnits: true
113 Layout.fillWidth: true
114 visible: _isPitot(sensorTypeFact.rawValue) && controller.parameterExists(-1, paramPrefix + "RATIO")
118 text: qsTr("Auto calibrate ratio in flight")
119 fact: controller.getParameterFact(-1, paramPrefix + "AUTOCAL", false)
120 visible: _isPitot(sensorTypeFact.rawValue) && controller.parameterExists(-1, paramPrefix + "AUTOCAL")
126 // ─── Primary Sensor Configuration ───
129 heading: qsTr("Primary Airspeed Sensor")
130 visible: _arspdTypeAvailable
133 sourceComponent: basicSensorSettingsComponent
134 property string paramPrefix: "ARSPD_"
135 property Fact sensorTypeFact: _arspdType
139 // ─── Second Sensor Configuration ───
142 heading: qsTr("Second Airspeed Sensor")
143 visible: _arspd2TypeAvailable
146 sourceComponent: basicSensorSettingsComponent
147 property string paramPrefix: "ARSPD2_"
148 property Fact sensorTypeFact: _arspd2Type
152 // ─── Multi-Sensor Options ───
155 heading: qsTr("Multi-Sensor Options")
156 visible: _sensorEnabled && _sensor2Enabled
161 LabelledFactComboBox {
162 label: qsTr("Primary sensor")
163 fact: controller.getParameterFact(-1, "ARSPD_PRIMARY", false)
165 comboBoxPreferredWidth: _comboWidth
166 Layout.fillWidth: true
167 visible: controller.parameterExists(-1, "ARSPD_PRIMARY")
172 // ─── Airspeed Limits ───
175 heading: qsTr("Airspeed Limits")
176 visible: _sensorEnabled && controller.parameterExists(-1, "AIRSPEED_CRUISE")
181 LabelledFactTextField {
182 label: qsTr("Cruise airspeed")
183 fact: controller.getParameterFact(-1, "AIRSPEED_CRUISE", false)
184 textFieldPreferredWidth: _textFieldWidth
185 textFieldShowUnits: true
186 Layout.fillWidth: true
187 visible: controller.parameterExists(-1, "AIRSPEED_CRUISE")
190 LabelledFactTextField {
191 label: qsTr("Minimum airspeed")
192 fact: controller.getParameterFact(-1, "AIRSPEED_MIN", false)
193 textFieldPreferredWidth: _textFieldWidth
194 textFieldShowUnits: true
195 Layout.fillWidth: true
196 visible: controller.parameterExists(-1, "AIRSPEED_MIN")
199 LabelledFactTextField {
200 label: qsTr("Maximum airspeed")
201 fact: controller.getParameterFact(-1, "AIRSPEED_MAX", false)
202 textFieldPreferredWidth: _textFieldWidth
203 textFieldShowUnits: true
204 Layout.fillWidth: true
205 visible: controller.parameterExists(-1, "AIRSPEED_MAX")
208 LabelledFactTextField {
209 label: qsTr("Stall airspeed")
210 fact: controller.getParameterFact(-1, "AIRSPEED_STALL", false)
211 textFieldPreferredWidth: _textFieldWidth
212 textFieldShowUnits: true
213 Layout.fillWidth: true
214 visible: controller.parameterExists(-1, "AIRSPEED_STALL")
221 // ─── Advanced Tab ───
224 title: qsTr("Advanced")
227 Layout.fillWidth: true
228 spacing: ScreenTools.defaultFontPixelHeight
230 // ─── Shared Advanced Sensor Configuration Component ───
233 id: advancedSensorSettingsComponent
243 LabelledFactTextField {
244 label: qsTr("Airspeed offset")
245 fact: controller.getParameterFact(-1, paramPrefix + "OFFSET", false)
246 textFieldPreferredWidth: _textFieldWidth
247 textFieldShowUnits: true
248 Layout.fillWidth: true
249 visible: _isPitot(sensorTypeFact.rawValue) && controller.parameterExists(-1, paramPrefix + "OFFSET")
252 LabelledFactComboBox {
253 label: qsTr("Skip calibration")
254 fact: controller.getParameterFact(-1, paramPrefix + "SKIP_CAL", false)
256 comboBoxPreferredWidth: _comboWidth
257 Layout.fillWidth: true
258 visible: _isPitot(sensorTypeFact.rawValue) && controller.parameterExists(-1, paramPrefix + "SKIP_CAL")
261 LabelledFactComboBox {
262 label: qsTr("Pitot tube order")
263 fact: controller.getParameterFact(-1, paramPrefix + "TUBE_ORDR", false)
265 comboBoxPreferredWidth: _comboWidth
266 Layout.fillWidth: true
267 visible: _isPitot(sensorTypeFact.rawValue) && controller.parameterExists(-1, paramPrefix + "TUBE_ORDR")
270 LabelledFactComboBox {
271 label: qsTr("Analog pin")
272 fact: controller.getParameterFact(-1, paramPrefix + "PIN", false)
274 comboBoxPreferredWidth: _comboWidth
275 Layout.fillWidth: true
276 visible: _isAnalog(sensorTypeFact.rawValue) && controller.parameterExists(-1, paramPrefix + "PIN")
279 LabelledFactComboBox {
280 label: qsTr("I2C bus")
281 fact: controller.getParameterFact(-1, paramPrefix + "BUS", false)
283 comboBoxPreferredWidth: _comboWidth
284 Layout.fillWidth: true
285 visible: _isI2C(sensorTypeFact.rawValue) && controller.parameterExists(-1, paramPrefix + "BUS")
288 LabelledFactTextField {
289 label: qsTr("PSI range")
290 fact: controller.getParameterFact(-1, paramPrefix + "PSI_RANGE", false)
291 textFieldPreferredWidth: _textFieldWidth
292 textFieldShowUnits: true
293 Layout.fillWidth: true
294 visible: _hasPsiRange(sensorTypeFact.rawValue) && controller.parameterExists(-1, paramPrefix + "PSI_RANGE")
299 // ─── Sensor Advanced Settings ───
302 heading: qsTr("Sensor Settings")
303 visible: _sensorEnabled
309 sourceComponent: advancedSensorSettingsComponent
310 active: _sensorEnabled
311 property string paramPrefix: "ARSPD_"
312 property Fact sensorTypeFact: _arspdType
313 property string sensorLabel: qsTr("Primary Sensor")
317 sourceComponent: advancedSensorSettingsComponent
318 active: _sensor2Enabled
319 property string paramPrefix: "ARSPD2_"
320 property Fact sensorTypeFact: _arspd2Type
321 property string sensorLabel: qsTr("Second Sensor")
326 // ─── Health Monitoring ───
329 heading: qsTr("Health Monitoring")
330 visible: _sensorEnabled
335 LabelledFactTextField {
336 label: qsTr("Max airspeed/groundspeed difference")
337 fact: controller.getParameterFact(-1, "ARSPD_WIND_MAX", false)
338 textFieldPreferredWidth: _textFieldWidth
339 textFieldShowUnits: true
340 Layout.fillWidth: true
341 visible: controller.parameterExists(-1, "ARSPD_WIND_MAX")
344 LabelledFactTextField {
345 label: qsTr("Warning threshold")
346 fact: controller.getParameterFact(-1, "ARSPD_WIND_WARN", false)
347 textFieldPreferredWidth: _textFieldWidth
348 textFieldShowUnits: true
349 Layout.fillWidth: true
350 visible: controller.parameterExists(-1, "ARSPD_WIND_WARN")
353 LabelledFactTextField {
354 label: qsTr("Re-enable gate size")
355 fact: controller.getParameterFact(-1, "ARSPD_WIND_GATE", false)
356 textFieldPreferredWidth: _textFieldWidth
357 textFieldShowUnits: true
358 Layout.fillWidth: true
359 visible: controller.parameterExists(-1, "ARSPD_WIND_GATE")
362 LabelledFactTextField {
363 label: qsTr("Offset calibration error warning")
364 fact: controller.getParameterFact(-1, "ARSPD_OFF_PCNT", false)
365 textFieldPreferredWidth: _textFieldWidth
366 textFieldShowUnits: true
367 Layout.fillWidth: true
368 visible: controller.parameterExists(-1, "ARSPD_OFF_PCNT")
373 // ─── Airspeed Options ───
376 heading: qsTr("Airspeed Options")
377 visible: _sensorEnabled && controller.parameterExists(-1, "ARSPD_OPTIONS")
383 fact: controller.getParameterFact(-1, "ARSPD_OPTIONS", false)
384 Layout.preferredWidth: airspeedPage.availableWidth * 0.5