APMSafetyComponentSummaryCopter.qml 4.28 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 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 84 85
    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"
        }
    }

86 87 88 89
    Column {
        anchors.fill:       parent
        anchors.margins:    8

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

95 96 97 98 99 100 101 102
        VehicleSummaryRow {
            labelText: "Throttle failsafe:"
            valueText:  _failsafeThrEnableText
        }

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

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

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

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

127 128 129 130 131 132 133 134 135 136 137 138 139 140
        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
141 142
    }
}