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

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

FactPanel {
Don Gagne's avatar
Don Gagne committed
11 12 13 14
    id:     panel
    width:  grid.width
    height: grid.height
    color:  qgcPal.windowShade
Don Gagne's avatar
Don Gagne committed
15 16 17 18

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

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

22 23 24 25
    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
26 27 28 29 30
    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
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"
        }
    }

Don Gagne's avatar
Don Gagne committed
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
    Grid {
        id:         grid
        rows:       8
        columns:    2
        spacing:    ScreenTools.defaultFontPixelWidth / 2

        QGCLabel { text: "Throttle failsafe:" }
        QGCLabel { text: _failsafeThrEnableText }

        QGCLabel { text: "Battery failsafe:" }
        QGCLabel { text: _failsafeBattEnableText }

        QGCLabel { text: "GeoFence:" }
        QGCLabel { text: _fenceEnable.value == 0 || _fenceType == 0 ?
                             "Disabled" :
                             (_fenceType.value == 1 ?
                                  "Altitude" :
                                  (_fenceType.value == 2 ? "Circle" : "Altitude,Circle")) }

        QGCLabel { text: "GeoFence:"; visible: _fenceEnable.value != 0 }
        QGCLabel { text: _fenceAction.value == 0 ?
                             "Report only" :
                             (_fenceAction.value == 1 ? "RTL or Land" : "Unknown")
            visible: _fenceEnable.value != 0
Don Gagne's avatar
Don Gagne committed
110 111
        }

Don Gagne's avatar
Don Gagne committed
112 113
        QGCLabel { text: "RTL min alt:" }
        QGCLabel { text: _rtlAltFact.value == 0 ? "current" : _rtlAltFact.valueString }
114

Don Gagne's avatar
Don Gagne committed
115 116
        QGCLabel { text: "RTL loiter time:" }
        QGCLabel { text: _rtlLoitTimeFact.valueString }
117

Don Gagne's avatar
Don Gagne committed
118 119
        QGCLabel { text: "RTL final alt:" }
        QGCLabel { text: _rtlAltFinalFact.value == 0 ? "Land" : _rtlAltFinalFact.valueString }
Don Gagne's avatar
Don Gagne committed
120

Don Gagne's avatar
Don Gagne committed
121 122
        QGCLabel { text: "Descent speed:" }
        QGCLabel { text: _landSpeedFact.valueString }
Don Gagne's avatar
Don Gagne committed
123 124
    }
}