@@ -12,18 +12,28 @@ import QtQuick
1212import QGroundControl
1313import QGroundControl.ScreenTools
1414import QGroundControl.Controls
15+ import QGroundControl.FactSystem
1516
1617Rectangle {
1718 anchors .margins : - ScreenTools .defaultFontPixelHeight
1819 height: warningsCol .height
1920 width: warningsCol .width
2021 color: Qt .rgba (1 , 1 , 1 , 0.5 )
2122 radius: ScreenTools .defaultFontPixelWidth / 2
22- visible: _noGPSLockVisible || _prearmErrorVisible
23+ visible: _noGPSLockVisible || _prearmErrorVisible || ( _altitudeWarnThresholdEnabled . value && (_vehicleAltitudeBelowMin || _vehicleAltitudeAboveMax || ! _terrainDataAvailable . value ))
2324
2425 property var _activeVehicle: QGroundControl .multiVehicleManager .activeVehicle
2526 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 .appSettings .altitudeWarnThresholdEnabled
30+ property Fact _altitudeWarnMinAGL: QGroundControl .settingsManager .appSettings .altitudeWarnMinAGL
31+ property Fact _altitudeWarnMaxAGL: QGroundControl .settingsManager .appSettings .altitudeWarnMaxAGL
32+ property Fact _altitudeAboveTerrain: _activeVehicle ? _activeVehicle .altitudeAboveTerr : null
33+ property Fact _terrainDataAvailable: _activeVehicle ? _activeVehicle .terrainDataAvailable : null
34+ property bool _vehicleAltitudeBelowMin: _activeVehicle && _activeVehicle .altitudeAboveTerr .value < _altitudeWarnMinAGL .value
35+ property bool _vehicleAltitudeAboveMax: _activeVehicle && _activeVehicle .altitudeAboveTerr .value > _altitudeWarnMaxAGL .value
36+ property bool _showAltitudeWarning: _activeVehicle && _activeVehicle .flying && ! _activeVehicle .landing
2737
2838 Column {
2939 id: warningsCol
@@ -45,6 +55,30 @@ Rectangle {
4555 text: _activeVehicle ? _activeVehicle .prearmError : " "
4656 }
4757
58+ QGCLabel {
59+ anchors .horizontalCenter : parent .horizontalCenter
60+ visible: _vehicleAltitudeBelowMin && _altitudeWarnThresholdEnabled .value && _showAltitudeWarning && _terrainDataAvailable .value
61+ color: " black"
62+ font .pointSize : ScreenTools .largeFontPointSize
63+ text: 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: _vehicleAltitudeAboveMax && _altitudeWarnThresholdEnabled .value && _showAltitudeWarning && _terrainDataAvailable .value
69+ color: " black"
70+ font .pointSize : ScreenTools .largeFontPointSize
71+ text: 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: ! _terrainDataAvailable .value && _altitudeWarnThresholdEnabled .value && _showAltitudeWarning
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+
4882 QGCLabel {
4983 anchors .horizontalCenter : parent .horizontalCenter
5084 visible: _prearmErrorVisible
0 commit comments