QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
APMFlightSafetyComponentSub.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3import QtQuick.Layouts
4
5import QGroundControl
6import QGroundControl.FactControls
7import QGroundControl.Controls
8
9SetupPage {
10 id: safetyPage
11 pageComponent: safetyPageComponent
12
13 Component {
14 id: safetyPageComponent
15
16 ColumnLayout {
17 id: flowLayout
18 spacing: _margins
19
20 FactPanelController { id: controller; }
21
22 QGCPalette { id: qgcPal; 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, "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, "BATT_LOW_VOLT", false)
43 property Fact _failsafeBatteryCapacity: controller.getParameterFact(-1, "BATT_LOW_MAH", false)
44 property bool _batteryDetected: controller.parameterExists(-1, "BATT_LOW_MAH")
45
46 property Fact _armingCheck: controller.getParameterFact(-1, "ARMING_CHECK", false)
47 property Fact _armingSkipCheck: controller.getParameterFact(-1, "ARMING_SKIPCHK", false)
48
49 property real _margins: ScreenTools.defaultFontPixelHeight
50 property real _textFieldWidth: ScreenTools.defaultFontPixelWidth * 15
51 property real _comboWidth: ScreenTools.defaultFontPixelWidth * 30
52
53 QGCGroupBox {
54 Layout.fillWidth: false
55 heading: qsTr("Failsafe Actions")
56
57 GridLayout {
58 columns: 2
59 rowSpacing: _margins / 2
60 columnSpacing: _margins / 2
61
62 QGCLabel { text: qsTr("GCS Heartbeat") }
63 FactComboBox {
64 Layout.maximumWidth: _comboWidth
65 fact: _failsafeGCSEnable
66 indexModel: false
67 sizeToContents: true
68 }
69
70 QGCLabel { text: qsTr("Leak") }
71 FactComboBox {
72 id: leakEnableCombo
73 Layout.maximumWidth: _comboWidth
74 fact: _failsafeLeakEnable
75 indexModel: false
76 sizeToContents: true
77 }
78
79 QGCLabel {
80 text: qsTr("Detector Pin")
81 visible: leakEnableCombo.currentIndex !== 0
82 }
83 FactComboBox {
84 Layout.maximumWidth: _comboWidth
85 visible: leakEnableCombo.currentIndex !== 0
86 fact: _failsafeLeakPin
87 indexModel: false
88 sizeToContents: true
89 }
90
91 QGCLabel {
92 text: qsTr("Logic when Dry")
93 visible: leakEnableCombo.currentIndex !== 0
94 }
95 FactComboBox {
96 Layout.maximumWidth: _comboWidth
97 visible: leakEnableCombo.currentIndex !== 0
98 fact: _failsafeLeakLogic
99 indexModel: false
100 sizeToContents: true
101 }
102
103 QGCLabel {
104 text: qsTr("Battery")
105 visible: !_firmware34
106 }
107 FactComboBox {
108 id: batteryEnableCombo
109 Layout.maximumWidth: _comboWidth
110 enabled: _batteryDetected
111 visible: !_firmware34
112 fact: _failsafeBatteryEnable
113 indexModel: false
114 sizeToContents: true
115 }
116
117 QGCLabel {
118 Layout.columnSpan: 2
119 text: qsTr("Power module not set up")
120 color: qgcPal.warningText
121 visible: !_firmware34 && !_batteryDetected
122 }
123
124 QGCLabel {
125 text: qsTr("Voltage")
126 visible: !_firmware34 && batteryEnableCombo.currentIndex !== 0
127 }
128 FactTextField {
129 Layout.preferredWidth: _textFieldWidth
130 visible: !_firmware34 && batteryEnableCombo.currentIndex !== 0
131 fact: _failsafeBatteryVoltage
132 }
133
134 QGCLabel {
135 text: qsTr("Remaining Capacity")
136 visible: !_firmware34 && batteryEnableCombo.currentIndex !== 0
137 }
138 FactTextField {
139 Layout.preferredWidth: _textFieldWidth
140 visible: !_firmware34 && batteryEnableCombo.currentIndex !== 0
141 fact: _failsafeBatteryCapacity
142 }
143
144 QGCLabel {
145 text: qsTr("EKF")
146 visible: !_firmware34
147 }
148 FactComboBox {
149 id: ekfEnableCombo
150 Layout.maximumWidth: _comboWidth
151 visible: !_firmware34
152 fact: _failsafeEKFEnable
153 indexModel: false
154 sizeToContents: true
155 }
156
157 QGCLabel {
158 text: qsTr("Threshold")
159 visible: !_firmware34 && ekfEnableCombo.currentIndex !== 0
160 }
161 FactTextField {
162 Layout.preferredWidth: _textFieldWidth
163 visible: !_firmware34 && ekfEnableCombo.currentIndex !== 0
164 fact: _failsafeEKFThreshold
165 }
166
167 QGCLabel {
168 text: qsTr("Pilot Input")
169 visible: !_firmware34
170 }
171 FactComboBox {
172 id: pilotEnableCombo
173 Layout.maximumWidth: _comboWidth
174 visible: !_firmware34
175 fact: _failsafePilotEnable
176 indexModel: false
177 sizeToContents: true
178 }
179
180 QGCLabel {
181 text: qsTr("Timeout")
182 visible: !_firmware34 && pilotEnableCombo.currentIndex !== 0
183 }
184 FactTextField {
185 Layout.preferredWidth: _textFieldWidth
186 visible: !_firmware34 && pilotEnableCombo.currentIndex !== 0
187 fact: _failsafePilotTimeout
188 }
189
190 QGCLabel { text: qsTr("Internal Temperature") }
191 FactComboBox {
192 id: temperatureEnableCombo
193 Layout.maximumWidth: _comboWidth
194 fact: _failsafeTemperatureEnable
195 indexModel: false
196 sizeToContents: true
197 }
198
199 QGCLabel {
200 text: qsTr("Threshold")
201 visible: temperatureEnableCombo.currentIndex !== 0
202 }
203 FactTextField {
204 Layout.preferredWidth: _textFieldWidth
205 visible: temperatureEnableCombo.currentIndex !== 0
206 fact: _failsafeTemperatureThreshold
207 }
208
209 QGCLabel { text: qsTr("Internal Pressure") }
210 FactComboBox {
211 id: pressureEnableCombo
212 Layout.maximumWidth: _comboWidth
213 fact: _failsafePressureEnable
214 indexModel: false
215 sizeToContents: true
216 }
217
218 QGCLabel {
219 text: qsTr("Threshold")
220 visible: pressureEnableCombo.currentIndex !== 0
221 }
222 FactTextField {
223 Layout.preferredWidth: _textFieldWidth
224 visible: pressureEnableCombo.currentIndex !== 0
225 fact: _failsafePressureThreshold
226 }
227 } // GridLayout
228 } // QGCGroupBox - Failsafe Actions
229
230 QGCGroupBox {
231 Layout.fillWidth: false
232 heading: _armingCheck ? qsTr("Arming Checks") : qsTr("Skip Arming Checks")
233
234 ColumnLayout {
235 spacing: _margins
236
237 FactBitmask {
238 Layout.preferredWidth: safetyPage.availableWidth * 0.75
239 firstEntryIsAll: _armingCheck ? true : false
240 fact: _armingCheck ? _armingCheck : _armingSkipCheck
241 }
242
243 QGCLabel {
244 Layout.fillWidth: true
245 wrapMode: Text.WordWrap
246 color: qgcPal.warningText
247 text: qsTr("Warning: Turning off arming checks can lead to loss of Vehicle control.")
248 visible: _armingCheck ? _armingCheck.value !== 1 : _armingSkipCheck.value !== 0
249 }
250 }
251 } // QGCGroupBox - Arming Checks
252 } // ColumnLayout
253 } // Component - safetyPageComponent
254} // SetupPage