APMSafetyComponentSummaryCopter.qml 4.53 KB
Newer Older
1
import QtQuick 2.2
Don Gagne's avatar
Don Gagne committed
2 3
import QtQuick.Controls 1.2

4 5 6 7
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
Don Gagne's avatar
Don Gagne committed
8 9

FactPanel {
10 11 12
    id:             panel
    anchors.fill:   parent
    color:          qgcPal.windowShadeDark
Don Gagne's avatar
Don Gagne committed
13 14 15 16

    QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
    FactPanelController { id: controller; factPanel: panel }

Don Gagne's avatar
Don Gagne committed
17 18 19
    property Fact _failsafeBattEnable:  controller.getParameterFact(-1, "FS_BATT_ENABLE")
    property Fact _failsafeThrEnable:   controller.getParameterFact(-1, "FS_THR_ENABLE")

20 21 22 23
    property Fact _fenceAction: controller.getParameterFact(-1, "FENCE_ACTION")
    property Fact _fenceEnable: controller.getParameterFact(-1, "FENCE_ENABLE")
    property Fact _fenceType:   controller.getParameterFact(-1, "FENCE_TYPE")

Don Gagne's avatar
Don Gagne committed
24 25 26 27 28
    property Fact _rtlAltFact:      controller.getParameterFact(-1, "RTL_ALT")
    property Fact _rtlLoitTimeFact: controller.getParameterFact(-1, "RTL_LOIT_TIME")
    property Fact _rtlAltFinalFact: controller.getParameterFact(-1, "RTL_ALT_FINAL")
    property Fact _landSpeedFact:   controller.getParameterFact(-1, "LAND_SPEED")

Don Gagne's avatar
Don Gagne committed
29 30
    property Fact _armingCheck: controller.getParameterFact(-1, "ARMING_CHECK")

Don Gagne's avatar
Don Gagne committed
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
    property string _failsafeBattEnableText
    property string _failsafeThrEnableText

    Component.onCompleted: {
        setFailsafeBattEnableText()
        setFailsafeThrEnableText()
    }

    Connections {
        target: _failsafeBattEnable

        onValueChanged: setFailsafeBattEnableText()
    }

    Connections {
        target: _failsafeThrEnable

        onValueChanged: setFailsafeThrEnableText()
    }

    function setFailsafeThrEnableText() {
        switch (_failsafeThrEnable.value) {
        case 0:
54
            _failsafeThrEnableText = qsTr("Disabled")
Don Gagne's avatar
Don Gagne committed
55 56
            break
        case 1:
57
            _failsafeThrEnableText = qsTr("Always RTL")
Don Gagne's avatar
Don Gagne committed
58 59
            break
        case 2:
60
            _failsafeThrEnableText = qsTr("Continue with Mission in Auto Mode")
Don Gagne's avatar
Don Gagne committed
61 62
            break
        case 3:
63
            _failsafeThrEnableText = qsTr("Always Land")
Don Gagne's avatar
Don Gagne committed
64 65
            break
        default:
66
            _failsafeThrEnableText = qsTr("Unknown")
Don Gagne's avatar
Don Gagne committed
67 68 69 70 71 72
        }
    }

    function setFailsafeBattEnableText() {
        switch (_failsafeBattEnable.value) {
        case 0:
73
            _failsafeBattEnableText = qsTr("Disabled")
Don Gagne's avatar
Don Gagne committed
74 75
            break
        case 1:
76
            _failsafeBattEnableText = qsTr("Land")
Don Gagne's avatar
Don Gagne committed
77 78
            break
        case 2:
79
            _failsafeBattEnableText = qsTr("Return to Launch")
Don Gagne's avatar
Don Gagne committed
80 81
            break
        default:
82
            _failsafeThrEnableText = qsTr("Unknown")
Don Gagne's avatar
Don Gagne committed
83 84 85
        }
    }

86 87 88
    Column {
        anchors.fill:       parent

Don Gagne's avatar
Don Gagne committed
89
        VehicleSummaryRow {
90 91
            labelText: qsTr("Arming Checks:")
            valueText:  _armingCheck.value & 1 ? qsTr("Enabled") : qsTr("Some disabled")
Don Gagne's avatar
Don Gagne committed
92 93
        }

94
        VehicleSummaryRow {
95
            labelText: qsTr("Throttle failsafe:")
96 97 98 99
            valueText:  _failsafeThrEnableText
        }

        VehicleSummaryRow {
100
            labelText: qsTr("Battery failsafe:")
101
            valueText:  _failsafeBattEnableText
Don Gagne's avatar
Don Gagne committed
102 103
        }

104
        VehicleSummaryRow {
105
            labelText: qsTr("GeoFence:")
106
            valueText: _fenceEnable.value == 0 || _fenceType == 0 ?
107
                           qsTr("Disabled") :
108
                           (_fenceType.value == 1 ?
109 110
                                qsTr("Altitude") :
                                (_fenceType.value == 2 ? qsTr("Circle") : qsTr("Altitude,Circle")))
111
        }
112

113
        VehicleSummaryRow {
114
            labelText: qsTr("GeoFence:")
115
            valueText: _fenceAction.value == 0 ?
116 117
                           qsTr("Report only") :
                           (_fenceAction.value == 1 ? qsTr("RTL or Land") : qsTr("Unknown"))
118 119
            visible:    _fenceEnable.value != 0
        }
120

121
        VehicleSummaryRow {
122
            labelText: qsTr("RTL min alt:")
Don Gagne's avatar
Don Gagne committed
123
            valueText: _rtlAltFact.value == 0 ? qsTr("current") : _rtlAltFact.valueString + " " + _rtlAltFact.units
124
        }
Don Gagne's avatar
Don Gagne committed
125

126
        VehicleSummaryRow {
127
            labelText: qsTr("RTL loiter time:")
Don Gagne's avatar
Don Gagne committed
128
            valueText: _rtlLoitTimeFact.valueString + " " + _rtlLoitTimeFact.units
129 130 131
        }

        VehicleSummaryRow {
132
            labelText: qsTr("RTL final alt:")
Don Gagne's avatar
Don Gagne committed
133
            valueText: _rtlAltFinalFact.value == 0 ? qsTr("Land") : _rtlAltFinalFact.valueString + " " + _rtlAltFinalFact.units
134 135 136
        }

        VehicleSummaryRow {
137
            labelText: qsTr("Descent speed:")
Don Gagne's avatar
Don Gagne committed
138
            valueText: _landSpeedFact.valueString + " " + _landSpeedFact.units
139
        }
Don Gagne's avatar
Don Gagne committed
140 141
    }
}