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