APMSafetyComponentSummaryCopter.qml 4.05 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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
    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:
            _failsafeThrEnableText = "Disabled"
            break
        case 1:
            _failsafeThrEnableText = "Always RTL"
            break
        case 2:
            _failsafeThrEnableText = "Continue with Mission in Auto Mode"
            break
        case 3:
            _failsafeThrEnableText = "Always Land"
            break
        default:
            _failsafeThrEnableText = "Unknown"
        }
    }

    function setFailsafeBattEnableText() {
        switch (_failsafeBattEnable.value) {
        case 0:
            _failsafeBattEnableText = "Disabled"
            break
        case 1:
            _failsafeBattEnableText = "Land"
            break
        case 2:
            _failsafeBattEnableText = "Return to Launch"
            break
        default:
            _failsafeThrEnableText = "Unknown"
        }
    }

84 85 86 87 88 89 90 91 92 93 94 95
    Column {
        anchors.fill:       parent
        anchors.margins:    8

        VehicleSummaryRow {
            labelText: "Throttle failsafe:"
            valueText:  _failsafeThrEnableText
        }

        VehicleSummaryRow {
            labelText: "Battery failsafe:"
            valueText:  _failsafeBattEnableText
Don Gagne's avatar
Don Gagne committed
96 97
        }

98 99 100 101 102 103 104 105
        VehicleSummaryRow {
            labelText: "GeoFence:"
            valueText: _fenceEnable.value == 0 || _fenceType == 0 ?
                           "Disabled" :
                           (_fenceType.value == 1 ?
                                "Altitude" :
                                (_fenceType.value == 2 ? "Circle" : "Altitude,Circle"))
        }
106

107 108 109 110 111 112 113
        VehicleSummaryRow {
            labelText: "GeoFence:"
            valueText: _fenceAction.value == 0 ?
                           "Report only" :
                           (_fenceAction.value == 1 ? "RTL or Land" : "Unknown")
            visible:    _fenceEnable.value != 0
        }
114

115 116 117 118
        VehicleSummaryRow {
            labelText: "RTL min alt:"
            valueText: _rtlAltFact.value == 0 ? "current" : _rtlAltFact.valueString
        }
Don Gagne's avatar
Don Gagne committed
119

120 121 122 123 124 125 126 127 128 129 130 131 132 133
        VehicleSummaryRow {
            labelText: "RTL loiter time:"
            valueText: _rtlLoitTimeFact.valueString
        }

        VehicleSummaryRow {
            labelText: "RTL final alt:"
            valueText: _rtlAltFinalFact.value == 0 ? "Land" : _rtlAltFinalFact.valueString
        }

        VehicleSummaryRow {
            labelText: "Descent speed:"
            valueText: _landSpeedFact.valueString
        }
Don Gagne's avatar
Don Gagne committed
134 135
    }
}