SafetyComponent.qml 4.97 KB
Newer Older
Don Gagne's avatar
Don Gagne committed
1 2 3 4
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QGroundControl.FactSystem 1.0
5
import QGroundControl.FactControls 1.0
Don Gagne's avatar
Don Gagne committed
6 7 8 9

Rectangle {
    QGCPalette { id: palette; colorGroup: QGCPalette.Active }

10
    width: 600
11
    height: 600
Don Gagne's avatar
Don Gagne committed
12
    color: palette.window
13
    property var leftColWidth: 350
Don Gagne's avatar
Don Gagne committed
14 15

    Column {
16
        anchors.fill: parent
17 18 19
        spacing: 40
        //-----------------------------------------------------------------
        //-- Return Home Triggers
20
        Column {
21 22
            spacing: 18
            Label { text: "Triggers For Return Home"; color: palette.windowText; font.pointSize: 20 }
23
            Row {
24 25 26 27 28 29 30 31 32 33 34 35 36 37
                FactCheckBox {
                    id: telemetryLossCheckbox
                    fact: autopilot.parameters["COM_DL_LOSS_EN"]
                    width: leftColWidth
                    checkedValue: 1
                    uncheckedValue: 0
                    text: "Telemetry signal timeout - Return Home After"
                    anchors.baseline: telemetryLossField.baseline
                }
                FactTextField {
                    id: telemetryLossField
                    fact: autopilot.parameters["NAV_DLL_N"];
                    showUnits: true
                }
38 39
            }
            Row {
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
                Label {
                    width: leftColWidth
                    text: "RC Transmitter signal loss - Return Home After"
                    color: palette.windowText
                    anchors.baseline: rcLossField.baseline
                }
                FactTextField {
                    id: rcLossField
                    fact: autopilot.parameters["COM_RC_LOSS_T"]
                    showUnits: true
                }
            }
        }
        //-----------------------------------------------------------------
        //-- Return Home Options
        Column {
            spacing: 18
            Label { text: "Return Home Options"; color: palette.windowText; font.pointSize: 20 }
            Row {
                Label {
                    width: leftColWidth
                    text: "Climb to minimum altitude of "
                    color: palette.windowText
                    anchors.baseline: climbField.baseline
                }
                FactTextField {
                    id: climbField
                    fact: autopilot.parameters["RTL_RETURN_ALT"]
                    showUnits: true
                }
70 71 72 73 74
            }
            Row {
                CheckBox {
                    id: homeLoiterCheckbox
                    property Fact fact: autopilot.parameters["RTL_LAND_DELAY"]
75
                    width: leftColWidth
76
                    checked: fact.value > 0
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
                    text: "Loiter at Home altitude for "
                    onClicked: {
                        fact.value = checked ? 60 : -1
                    }
                    style: CheckBoxStyle {
                        label: Text {
                            color: palette.windowText
                            text: control.text
                        }
                    }
                }
                FactTextField {
                    fact: autopilot.parameters["RTL_LAND_DELAY"];
                    showUnits: true
                    anchors.baseline: homeLoiterCheckbox.baseline
92
                    enabled: homeLoiterCheckbox.checked == true
93 94
                }
            }
95 96 97 98
            //-------------------------------------------------------------
            //-- Visible only if loiter above is checked
            //   TODO The "enabled" property could be used instead but it
            //   would have to handle a different "disabled" palette.
99
            Row {
100 101 102 103 104 105
                Label {
                    width: leftColWidth;
                    text: "When Home is reached, loiter at an altitude of ";
                    color: palette.windowText;
                    anchors.baseline: descendField.baseline
                    visible: homeLoiterCheckbox.checked == true
106 107
                }
                FactTextField {
108 109 110
                    id: descendField;
                    fact: autopilot.parameters["RTL_DESCEND_ALT"];
                    visible: homeLoiterCheckbox.checked == true
111 112 113 114 115 116 117
                    showUnits: true
                }
            }
        }

        Text {
            width: parent.width
118
            font.pointSize: 14
119
            text: "Warning: You have an advanced safety configuration set using the NAV_RCL_OBC parameter. The above settings may not apply.";
120
            visible: autopilot.parameters["NAV_RCL_OBC"].value == 0
121 122 123 124 125
            color: palette.windowText
            wrapMode: Text.Wrap
        }
        Text {
            width: parent.width
126
            font.pointSize: 14
127
            text: "Warning: You have an advanced safety configuration set using the NAV_DLL_OBC parameter. The above settings may not apply.";
128
            visible: autopilot.parameters["NAV_DLL_OBC"].value == 0
129 130 131
            color: palette.windowText
            wrapMode: Text.Wrap
        }
Don Gagne's avatar
Don Gagne committed
132 133
    }
}