QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
APMSafetyComponentSub.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3
4import QGroundControl
5import QGroundControl.FactControls
6import QGroundControl.Controls
7
8SetupPage {
9 id: safetyPage
10 pageComponent: safetyPageComponent
11
12 Component {
13 id: safetyPageComponent
14
15 Flow {
16 id: flowLayout
17 width: availableWidth
18 spacing: _margins
19
20 FactPanelController { id: controller; }
21
22 QGCPalette { id: ggcPal; colorGroupEnabled: true }
23
24 property bool _firmware34: globals.activeVehicle.versionCompare(3, 5, 0) < 0
25
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")
34
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")
45
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 */)
49
50 property real _margins: ScreenTools.defaultFontPixelHeight
51 property bool _showIcon: !ScreenTools.isTinyScreen
52
53 Column {
54 spacing: _margins / 2
55
56 QGCLabel {
57 id: failsafeLabel
58 text: qsTr("Failsafe Actions")
59 font.bold: true
60 }
61
62 Rectangle {
63 id: failsafeRectangle
64 width: flowLayout.width
65 height: childrenRect.height + _margins
66 color: ggcPal.windowShade
67
68 Column {
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
74 id: failsafeSettings
75 spacing: ScreenTools.defaultFontPixelHeight
76
77 Row {
78 spacing: _margins / 2
79
80 QGCLabel {
81 id: gcsEnableLabel
82 width: failsafeSettings._labelWidth
83 anchors.verticalCenter: gcsEnableCombo.verticalCenter
84 text: qsTr("GCS Heartbeat:")
85 wrapMode: Text.Wrap
86 }
87
88 FactComboBox {
89 id: gcsEnableCombo
90 width: failsafeSettings._editWidth
91 fact: _failsafeGCSEnable
92 indexModel: false
93 }
94 }
95
96 Row {
97 spacing: _margins / 2
98
99 QGCLabel {
100 id: leakEnableLabel
101 width: failsafeSettings._labelWidth
102 anchors.verticalCenter: leakEnableCombo.verticalCenter
103 text: qsTr("Leak:")
104 wrapMode: Text.Wrap
105 }
106
107 FactComboBox {
108 id: leakEnableCombo
109 width: failsafeSettings._editWidth
110 fact: _failsafeLeakEnable
111 indexModel: false
112 }
113
114 QGCLabel {
115 text: qsTr("Detector Pin:")
116 width: failsafeSettings._labelWidth
117 anchors.verticalCenter: leakEnableCombo.verticalCenter
118 visible: leakEnableCombo.currentIndex != 0
119 }
120
121 FactComboBox {
122 width: failsafeSettings._editWidth
123 visible: leakEnableCombo.currentIndex != 0
124 anchors.verticalCenter: leakEnableCombo.verticalCenter
125 fact: _failsafeLeakPin
126 indexModel: false
127 }
128
129 QGCLabel {
130 text: qsTr("Logic when Dry:")
131 width: failsafeSettings._labelWidth
132 visible: leakEnableCombo.currentIndex != 0
133 anchors.verticalCenter: leakEnableCombo.verticalCenter
134 }
135
136 FactComboBox {
137 width: failsafeSettings._editWidth
138 visible: leakEnableCombo.currentIndex != 0
139 anchors.verticalCenter: leakEnableCombo.verticalCenter
140 fact: _failsafeLeakLogic
141 indexModel: false
142 }
143 }
144
145 Row {
146 spacing: _margins / 2
147 visible: !_firmware34
148
149 QGCLabel {
150 id: batteryEnableLabel
151 width: failsafeSettings._labelWidth
152 anchors.verticalCenter: batteryEnableCombo.verticalCenter
153 text: qsTr("Battery:")
154 wrapMode: Text.Wrap
155 }
156
157 FactComboBox {
158 id: batteryEnableCombo
159 enabled: _batteryDetected
160 width: failsafeSettings._editWidth
161 fact: _failsafeBatteryEnable
162 indexModel: false
163 }
164
165 QGCLabel {
166 text: qsTr("Power module not set up")
167 width: failsafeSettings._labelWidth
168 color: ggcPal.warningText
169 anchors.verticalCenter: batteryEnableCombo.verticalCenter
170 visible: !_batteryDetected
171 }
172
173 QGCLabel {
174 text: qsTr("Voltage:")
175 width: failsafeSettings._labelWidth
176 anchors.verticalCenter: batteryEnableCombo.verticalCenter
177 visible: batteryEnableCombo.currentIndex != 0
178 }
179
180 FactTextField {
181 width: failsafeSettings._editWidth
182 anchors.verticalCenter: batteryEnableCombo.verticalCenter
183 visible: batteryEnableCombo.currentIndex != 0
184 fact: _failsafeBatteryVoltage
185 }
186
187 QGCLabel {
188 text: qsTr("Remaining Capacity:")
189 width: failsafeSettings._labelWidth
190 anchors.verticalCenter: batteryEnableCombo.verticalCenter
191 visible: batteryEnableCombo.currentIndex != 0
192 }
193
194 FactTextField {
195 width: failsafeSettings._editWidth
196 anchors.verticalCenter: batteryEnableCombo.verticalCenter
197 visible: batteryEnableCombo.currentIndex != 0
198 fact: _failsafeBatteryCapacity
199 }
200 }
201
202 Row {
203 spacing: _margins / 2
204 visible: !_firmware34
205
206 QGCLabel {
207 id: ekfEnableLabel
208 width: failsafeSettings._labelWidth
209 anchors.verticalCenter: ekfEnableCombo.verticalCenter
210 text: qsTr("EKF:")
211 wrapMode: Text.Wrap
212 }
213
214 FactComboBox {
215 id: ekfEnableCombo
216 width: failsafeSettings._editWidth
217 fact: _failsafeEKFEnable
218 indexModel: false
219 }
220
221 QGCLabel {
222 text: "Threshold:"
223 width: failsafeSettings._labelWidth
224 visible: ekfEnableCombo.currentIndex != 0
225 anchors.baseline: ekfEnableCombo.baseline
226 }
227
228 FactTextField {
229 width: failsafeSettings._editWidth
230 visible: ekfEnableCombo.currentIndex != 0
231 anchors.baseline: ekfEnableCombo.baseline
232 fact: _failsafeEKFThreshold
233 }
234 }
235
236 Row {
237 spacing: _margins / 2
238 visible: !_firmware34
239
240 QGCLabel {
241 id: pilotEnableLabel
242 width: failsafeSettings._labelWidth
243 anchors.verticalCenter: pilotEnableCombo.verticalCenter
244 text: qsTr("Pilot Input:")
245 wrapMode: Text.Wrap
246 }
247
248 FactComboBox {
249 id: pilotEnableCombo
250 width: failsafeSettings._editWidth
251 fact: _failsafePilotEnable
252 indexModel: false
253 }
254
255 QGCLabel {
256 text: qsTr("Timeout:")
257 width: failsafeSettings._labelWidth
258 anchors.verticalCenter: pilotEnableCombo.verticalCenter
259 visible: pilotEnableCombo.currentIndex != 0
260
261 }
262
263 FactTextField {
264 width: failsafeSettings._editWidth
265 anchors.verticalCenter: pilotEnableCombo.verticalCenter
266 visible: pilotEnableCombo.currentIndex != 0
267 anchors.baseline: pilotEnableCombo.baseline
268 fact: _failsafePilotTimeout
269 }
270 }
271
272 Row {
273 spacing: _margins / 2
274
275 QGCLabel {
276 id: temperatureEnableLabel
277 width: failsafeSettings._labelWidth
278 anchors.verticalCenter: temperatureEnableCombo.verticalCenter
279 text: qsTr("Internal Temperature:")
280 wrapMode: Text.Wrap
281 }
282
283 FactComboBox {
284 id: temperatureEnableCombo
285 width: failsafeSettings._editWidth
286 fact: _failsafeTemperatureEnable
287 indexModel: false
288 }
289
290 QGCLabel {
291 text: qsTr("Threshold:")
292 width: failsafeSettings._labelWidth
293 visible: temperatureEnableCombo.currentIndex != 0
294 anchors.baseline: temperatureEnableCombo.baseline
295 }
296
297 FactTextField {
298 width: failsafeSettings._editWidth
299 visible: temperatureEnableCombo.currentIndex != 0
300 anchors.baseline: temperatureEnableCombo.baseline
301 fact: _failsafeTemperatureThreshold
302 }
303 }
304
305 Row {
306 spacing: _margins / 2
307
308 QGCLabel {
309 id: pressureEnableLabel
310 width: failsafeSettings._labelWidth
311 anchors.verticalCenter: pressureEnableCombo.verticalCenter
312 text: qsTr("Internal Pressure:")
313 wrapMode: Text.Wrap
314 }
315
316 FactComboBox {
317 id: pressureEnableCombo
318 width: failsafeSettings._editWidth
319 fact: _failsafePressureEnable
320 indexModel: false
321 }
322
323 QGCLabel {
324 text: qsTr("Threshold:")
325 width: failsafeSettings._labelWidth
326 visible: pressureEnableCombo.currentIndex != 0
327 anchors.baseline: pressureEnableCombo.baseline
328 }
329
330 FactTextField {
331 width: failsafeSettings._editWidth
332 visible: pressureEnableCombo.currentIndex != 0
333 anchors.baseline: pressureEnableCombo.baseline
334 fact: _failsafePressureThreshold
335 }
336 }
337 } // Column - Failsafe Settings
338 }// Rectangle - Failsafe Settings
339 } // Column - Failsafe Settings
340
341 Column {
342 spacing: _margins / 2
343
344 QGCLabel {
345 text: _armingCheck ? qsTr("Arming Checks") : qsTr("Skip Arming Checks")
346 font.bold: true
347 }
348
349 Rectangle {
350 width: flowLayout.width
351 height: armingCheckInnerColumn.height + (_margins * 2)
352 color: ggcPal.windowShade
353
354 Column {
355 id: armingCheckInnerColumn
356 anchors.margins: _margins
357 anchors.top: parent.top
358 anchors.left: parent.left
359 anchors.right: parent.right
360 spacing: _margins
361
362 FactBitmask {
363 id: armingCheckBitmask
364 anchors.left: parent.left
365 anchors.right: parent.right
366 firstEntryIsAll: _armingCheck ? true : false
367 fact: _armingCheck ? _armingCheck : _armingSkipCheck
368 }
369
370 QGCLabel {
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
378 }
379 }
380 } // Rectangle - Arming checks
381 } // Column - Arming Checks
382 } // Flow
383 } // Component - safetyPageComponent
384} // SetupView