@@ -12,18 +12,28 @@ import QtQuick
12
12
import QGroundControl
13
13
import QGroundControl.ScreenTools
14
14
import QGroundControl.Controls
15
+ import QGroundControl.FactSystem
15
16
16
17
Rectangle {
17
18
anchors .margins : - ScreenTools .defaultFontPixelHeight
18
19
height: warningsCol .height
19
20
width: warningsCol .width
20
21
color: Qt .rgba (1 , 1 , 1 , 0.5 )
21
22
radius: ScreenTools .defaultFontPixelWidth / 2
22
- visible: _noGPSLockVisible || _prearmErrorVisible
23
+ visible: _noGPSLockVisible || _prearmErrorVisible || (_showAltitudeWarning && (_vehicleAltitudeBelowMin || _vehicleAltitudeAboveMax || ! _terrainDataAvailable . value ))
23
24
24
25
property var _activeVehicle: QGroundControl .multiVehicleManager .activeVehicle
25
26
property bool _noGPSLockVisible: _activeVehicle && _activeVehicle .requiresGpsFix && ! _activeVehicle .coordinate .isValid
26
- property bool _prearmErrorVisible: _activeVehicle && ! _activeVehicle .armed && _activeVehicle .prearmError && ! _activeVehicle .healthAndArmingCheckReport .supported
27
+ property bool _prearmErrorVisible: _activeVehicle && ! _activeVehicle .armed && _activeVehicle .prearmError
28
+
29
+ property Fact _altitudeWarnThresholdEnabled: QGroundControl .settingsManager .flyViewSettings .altitudeWarnThresholdEnabled
30
+ property Fact _altitudeWarnMinAGL: QGroundControl .settingsManager .flyViewSettings .altitudeWarnMinAGL
31
+ property Fact _altitudeWarnMaxAGL: QGroundControl .settingsManager .flyViewSettings .altitudeWarnMaxAGL
32
+ property Fact _altitudeAboveTerrain: _activeVehicle ? _activeVehicle .altitudeAboveTerr : null
33
+ property Fact _terrainDataAvailable: _activeVehicle ? _activeVehicle .terrainDataAvailable : null
34
+ property bool _vehicleAltitudeBelowMin: _altitudeAboveTerrain ? (_altitudeAboveTerrain .value < _altitudeWarnMinAGL .value ) : false
35
+ property bool _vehicleAltitudeAboveMax: _altitudeAboveTerrain ? (_altitudeAboveTerrain .value > _altitudeWarnMaxAGL .value ) : false
36
+ property bool _showAltitudeWarning: _activeVehicle && _activeVehicle .flying && ! _activeVehicle .landing && _altitudeWarnThresholdEnabled .value
27
37
28
38
Column {
29
39
id: warningsCol
@@ -45,6 +55,30 @@ Rectangle {
45
55
text: _activeVehicle ? _activeVehicle .prearmError : " "
46
56
}
47
57
58
+ QGCLabel {
59
+ anchors .horizontalCenter : parent .horizontalCenter
60
+ visible: _showAltitudeWarning && _terrainDataAvailable .value && _vehicleAltitudeBelowMin
61
+ color: " black"
62
+ font .pointSize : ScreenTools .largeFontPointSize
63
+ text: visible ? qsTr (" Altitude below minimum threshold of %1 %2 above terrain: (%3 %4)" ).arg (_altitudeWarnMinAGL .value ).arg (_altitudeWarnMinAGL .units ).arg (_altitudeAboveTerrain .value .toFixed (2 )).arg (_altitudeAboveTerrain .units ) : " "
64
+ }
65
+
66
+ QGCLabel {
67
+ anchors .horizontalCenter : parent .horizontalCenter
68
+ visible: _showAltitudeWarning && _terrainDataAvailable .value && _vehicleAltitudeAboveMax
69
+ color: " black"
70
+ font .pointSize : ScreenTools .largeFontPointSize
71
+ text: visible ? qsTr (" Altitude above maximum threshold of %1 %2 above terrain: (%3 %4)" ).arg (_altitudeWarnMaxAGL .value ).arg (_altitudeWarnMaxAGL .units ).arg (_altitudeAboveTerrain .value .toFixed (2 )).arg (_altitudeAboveTerrain .units ) : " "
72
+ }
73
+
74
+ QGCLabel {
75
+ anchors .horizontalCenter : parent .horizontalCenter
76
+ visible: _showAltitudeWarning && ! _terrainDataAvailable .value
77
+ color: " black"
78
+ font .pointSize : ScreenTools .largeFontPointSize
79
+ text: qsTr (" Terrain data not available at vehicle pos, altitude warning thresholds are disabled" )
80
+ }
81
+
48
82
QGCLabel {
49
83
anchors .horizontalCenter : parent .horizontalCenter
50
84
visible: _prearmErrorVisible
0 commit comments