5import QGroundControl.FactControls
6import QGroundControl.Controls
10 pageComponent: safetyPageComponent
13 id: safetyPageComponent
20 FactPanelController { id: controller; }
22 QGCPalette { id: ggcPal; colorGroupEnabled: true }
24 property bool _firmware34: globals.activeVehicle.versionCompare(3, 5, 0) < 0
26 // Enable/Action parameters
27 property Fact _failsafeBatteryEnable: controller.getParameterFact(-1, "r.BATT_FS_LOW_ACT", false)
28 property Fact _failsafeEKFEnable: controller.getParameterFact(-1, "FS_EKF_ACTION")
29 property Fact _failsafeGCSEnable: controller.getParameterFact(-1, "FS_GCS_ENABLE")
30 property Fact _failsafeLeakEnable: controller.getParameterFact(-1, "FS_LEAK_ENABLE")
31 property Fact _failsafePilotEnable: _firmware34 ? null : controller.getParameterFact(-1, "FS_PILOT_INPUT")
32 property Fact _failsafePressureEnable: controller.getParameterFact(-1, "FS_PRESS_ENABLE")
33 property Fact _failsafeTemperatureEnable: controller.getParameterFact(-1, "FS_TEMP_ENABLE")
35 // Threshold parameters
36 property Fact _failsafePressureThreshold: controller.getParameterFact(-1, "FS_PRESS_MAX")
37 property Fact _failsafeTemperatureThreshold: controller.getParameterFact(-1, "FS_TEMP_MAX")
38 property Fact _failsafePilotTimeout: _firmware34 ? null : controller.getParameterFact(-1, "FS_PILOT_TIMEOUT")
39 property Fact _failsafeLeakPin: controller.getParameterFact(-1, "LEAK1_PIN")
40 property Fact _failsafeLeakLogic: controller.getParameterFact(-1, "LEAK1_LOGIC")
41 property Fact _failsafeEKFThreshold: controller.getParameterFact(-1, "FS_EKF_THRESH")
42 property Fact _failsafeBatteryVoltage: controller.getParameterFact(-1, "r.BATT_LOW_VOLT", false)
43 property Fact _failsafeBatteryCapacity: controller.getParameterFact(-1, "r.BATT_LOW_MAH", false)
44 property bool _batteryDetected: controller.parameterExists(-1, "r.BATT_LOW_MAH")
46 // Older firmwares use ARMING_CHECK. Newer firmwares use ARMING_SKIPCHK.
47 property Fact _armingCheck: controller.getParameterFact(-1, "ARMING_CHECK", false /* reportMissing */)
48 property Fact _armingSkipCheck: controller.getParameterFact(-1, "ARMING_SKIPCHK", false /* reportMissing */)
50 property real _margins: ScreenTools.defaultFontPixelHeight
51 property bool _showIcon: !ScreenTools.isTinyScreen
58 text: qsTr("Failsafe Actions")
64 width: flowLayout.width
65 height: childrenRect.height + _margins
66 color: ggcPal.windowShade
69 anchors.top: failsafeRectangle.top
70 anchors.left: failsafeRectangle.left
71 anchors.margins: _margins / 2
72 property var _labelWidth: ScreenTools.defaultFontPixelWidth * 15
73 property var _editWidth: ScreenTools.defaultFontPixelWidth * 20
75 spacing: ScreenTools.defaultFontPixelHeight
82 width: failsafeSettings._labelWidth
83 anchors.verticalCenter: gcsEnableCombo.verticalCenter
84 text: qsTr("GCS Heartbeat:")
90 width: failsafeSettings._editWidth
91 fact: _failsafeGCSEnable
101 width: failsafeSettings._labelWidth
102 anchors.verticalCenter: leakEnableCombo.verticalCenter
109 width: failsafeSettings._editWidth
110 fact: _failsafeLeakEnable
115 text: qsTr("Detector Pin:")
116 width: failsafeSettings._labelWidth
117 anchors.verticalCenter: leakEnableCombo.verticalCenter
118 visible: leakEnableCombo.currentIndex != 0
122 width: failsafeSettings._editWidth
123 visible: leakEnableCombo.currentIndex != 0
124 anchors.verticalCenter: leakEnableCombo.verticalCenter
125 fact: _failsafeLeakPin
130 text: qsTr("Logic when Dry:")
131 width: failsafeSettings._labelWidth
132 visible: leakEnableCombo.currentIndex != 0
133 anchors.verticalCenter: leakEnableCombo.verticalCenter
137 width: failsafeSettings._editWidth
138 visible: leakEnableCombo.currentIndex != 0
139 anchors.verticalCenter: leakEnableCombo.verticalCenter
140 fact: _failsafeLeakLogic
146 spacing: _margins / 2
147 visible: !_firmware34
150 id: batteryEnableLabel
151 width: failsafeSettings._labelWidth
152 anchors.verticalCenter: batteryEnableCombo.verticalCenter
153 text: qsTr("Battery:")
158 id: batteryEnableCombo
159 enabled: _batteryDetected
160 width: failsafeSettings._editWidth
161 fact: _failsafeBatteryEnable
166 text: qsTr("Power module not set up")
167 width: failsafeSettings._labelWidth
168 color: ggcPal.warningText
169 anchors.verticalCenter: batteryEnableCombo.verticalCenter
170 visible: !_batteryDetected
174 text: qsTr("Voltage:")
175 width: failsafeSettings._labelWidth
176 anchors.verticalCenter: batteryEnableCombo.verticalCenter
177 visible: batteryEnableCombo.currentIndex != 0
181 width: failsafeSettings._editWidth
182 anchors.verticalCenter: batteryEnableCombo.verticalCenter
183 visible: batteryEnableCombo.currentIndex != 0
184 fact: _failsafeBatteryVoltage
188 text: qsTr("Remaining Capacity:")
189 width: failsafeSettings._labelWidth
190 anchors.verticalCenter: batteryEnableCombo.verticalCenter
191 visible: batteryEnableCombo.currentIndex != 0
195 width: failsafeSettings._editWidth
196 anchors.verticalCenter: batteryEnableCombo.verticalCenter
197 visible: batteryEnableCombo.currentIndex != 0
198 fact: _failsafeBatteryCapacity
203 spacing: _margins / 2
204 visible: !_firmware34
208 width: failsafeSettings._labelWidth
209 anchors.verticalCenter: ekfEnableCombo.verticalCenter
216 width: failsafeSettings._editWidth
217 fact: _failsafeEKFEnable
223 width: failsafeSettings._labelWidth
224 visible: ekfEnableCombo.currentIndex != 0
225 anchors.baseline: ekfEnableCombo.baseline
229 width: failsafeSettings._editWidth
230 visible: ekfEnableCombo.currentIndex != 0
231 anchors.baseline: ekfEnableCombo.baseline
232 fact: _failsafeEKFThreshold
237 spacing: _margins / 2
238 visible: !_firmware34
242 width: failsafeSettings._labelWidth
243 anchors.verticalCenter: pilotEnableCombo.verticalCenter
244 text: qsTr("Pilot Input:")
250 width: failsafeSettings._editWidth
251 fact: _failsafePilotEnable
256 text: qsTr("Timeout:")
257 width: failsafeSettings._labelWidth
258 anchors.verticalCenter: pilotEnableCombo.verticalCenter
259 visible: pilotEnableCombo.currentIndex != 0
264 width: failsafeSettings._editWidth
265 anchors.verticalCenter: pilotEnableCombo.verticalCenter
266 visible: pilotEnableCombo.currentIndex != 0
267 anchors.baseline: pilotEnableCombo.baseline
268 fact: _failsafePilotTimeout
273 spacing: _margins / 2
276 id: temperatureEnableLabel
277 width: failsafeSettings._labelWidth
278 anchors.verticalCenter: temperatureEnableCombo.verticalCenter
279 text: qsTr("Internal Temperature:")
284 id: temperatureEnableCombo
285 width: failsafeSettings._editWidth
286 fact: _failsafeTemperatureEnable
291 text: qsTr("Threshold:")
292 width: failsafeSettings._labelWidth
293 visible: temperatureEnableCombo.currentIndex != 0
294 anchors.baseline: temperatureEnableCombo.baseline
298 width: failsafeSettings._editWidth
299 visible: temperatureEnableCombo.currentIndex != 0
300 anchors.baseline: temperatureEnableCombo.baseline
301 fact: _failsafeTemperatureThreshold
306 spacing: _margins / 2
309 id: pressureEnableLabel
310 width: failsafeSettings._labelWidth
311 anchors.verticalCenter: pressureEnableCombo.verticalCenter
312 text: qsTr("Internal Pressure:")
317 id: pressureEnableCombo
318 width: failsafeSettings._editWidth
319 fact: _failsafePressureEnable
324 text: qsTr("Threshold:")
325 width: failsafeSettings._labelWidth
326 visible: pressureEnableCombo.currentIndex != 0
327 anchors.baseline: pressureEnableCombo.baseline
331 width: failsafeSettings._editWidth
332 visible: pressureEnableCombo.currentIndex != 0
333 anchors.baseline: pressureEnableCombo.baseline
334 fact: _failsafePressureThreshold
337 } // Column - Failsafe Settings
338 }// Rectangle - Failsafe Settings
339 } // Column - Failsafe Settings
342 spacing: _margins / 2
345 text: _armingCheck ? qsTr("Arming Checks") : qsTr("Skip Arming Checks")
350 width: flowLayout.width
351 height: armingCheckInnerColumn.height + (_margins * 2)
352 color: ggcPal.windowShade
355 id: armingCheckInnerColumn
356 anchors.margins: _margins
357 anchors.top: parent.top
358 anchors.left: parent.left
359 anchors.right: parent.right
363 id: armingCheckBitmask
364 anchors.left: parent.left
365 anchors.right: parent.right
366 firstEntryIsAll: _armingCheck ? true : false
367 fact: _armingCheck ? _armingCheck : _armingSkipCheck
371 id: armingCheckWarning
372 anchors.left: parent.left
373 anchors.right: parent.right
374 wrapMode: Text.WordWrap
375 color: qgcPal.warningText
376 text: qsTr("Warning: Turning off arming checks can lead to loss of Vehicle control.")
377 visible: _armingCheck ? _armingCheck.value != 1 : _armingSkipCheck.value != 0
380 } // Rectangle - Arming checks
381 } // Column - Arming Checks
383 } // Component - safetyPageComponent