APMSafetyComponentSummaryCopter.qml 4.45 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 89
    Column {
        anchors.fill:       parent
        anchors.margins:    8

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

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

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

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

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

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

127
        VehicleSummaryRow {
128
            labelText: qsTr("RTL loiter time:")
129 130 131 132
            valueText: _rtlLoitTimeFact.valueString
        }

        VehicleSummaryRow {
133 134
            labelText: qsTr("RTL final alt:")
            valueText: _rtlAltFinalFact.value == 0 ? qsTr("Land") : _rtlAltFinalFact.valueString
135 136 137
        }

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