APMSafetyComponentSummaryRover.qml 3.02 KB
Newer Older
1 2 3 4 5 6 7 8
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/
Don Gagne's avatar
Don Gagne committed
9

10
import QtQuick 2.3
11
import QtQuick.Controls 1.2
Don Gagne's avatar
Don Gagne committed
12

13 14
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
Don Gagne's avatar
Don Gagne committed
15
import QGroundControl.Controls 1.0
16 17
import QGroundControl.Palette 1.0

18
Item {
19 20 21
    anchors.fill:   parent
    color:          qgcPal.windowShadeDark

22
    FactPanelController { id: controller; }
23 24 25 26 27 28 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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104

    property Fact _failsafeThrEnable:   controller.getParameterFact(-1, "FS_THR_ENABLE")
    property Fact _failsafeThrValue:    controller.getParameterFact(-1, "FS_THR_VALUE")
    property Fact _failsafeAction:      controller.getParameterFact(-1, "FS_ACTION")
    property Fact _failsafeCrashCheck:  controller.getParameterFact(-1, "FS_CRASH_CHECK")

    property Fact _armingCheck:         controller.getParameterFact(-1, "ARMING_CHECK")

    property string _failsafeActionText
    property string _failsafeCrashCheckText

    Component.onCompleted: {
        setFailsafeActionText()
        setFailsafeCrashCheckText()
    }

    Connections {
        target: _failsafeAction

        onValueChanged: setFailsafeActionText()
    }

    Connections {
        target: _failsafeCrashCheck

        onValueChanged: setFailsafeCrashCheckText()
    }

    function setFailsafeActionText() {
        switch (_failsafeAction.value) {
        case 0:
            _failsafeActionText = qsTr("Disabled")
            break
        case 1:
            _failsafeActionText = qsTr("Always RTL")
            break
        case 2:
            _failsafeActionText = qsTr("Always Hold")
            break
        default:
            _failsafeActionText = qsTr("Unknown")
        }
    }

    function setFailsafeCrashCheckText() {
        switch (_failsafeCrashCheck.value) {
        case 0:
            _failsafeCrashCheckText = qsTr("Disabled")
            break
        case 1:
            _failsafeCrashCheckText = qsTr("Hold")
            break
        case 2:
            _failsafeCrashCheckText = qsTr("Hold and Disarm")
            break
        default:
            _failsafeCrashCheckText = qsTr("Unknown")
        }
    }

    Column {
        anchors.fill:       parent

        VehicleSummaryRow {
            labelText: qsTr("Arming Checks:")
            valueText:  _armingCheck.value & 1 ? qsTr("Enabled") : qsTr("Some disabled")
        }

        VehicleSummaryRow {
            labelText: qsTr("Throttle failsafe:")
            valueText:  _failsafeThrEnable.value != 0 ? _failsafeThrValue.valueString : qsTr("Disabled")
        }

        VehicleSummaryRow {
            labelText: qsTr("Failsafe Action:")
            valueText: _failsafeActionText
        }

        VehicleSummaryRow {
            labelText: qsTr("Failsafe Crash Check:")
            valueText: _failsafeCrashCheckText
        }
Don Gagne's avatar
Don Gagne committed
105

106
    }
Don Gagne's avatar
Don Gagne committed
107
}