SafetyComponent.qml 4.96 KB
Newer Older
Don Gagne's avatar
Don Gagne committed
1 2 3
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
4

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

Rectangle {
10
    QGCPalette { id: palette; colorGroupEnabled: true }
Don Gagne's avatar
Don Gagne committed
11

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

    Column {
18
        anchors.fill: parent
19 20 21
        spacing: 40
        //-----------------------------------------------------------------
        //-- Return Home Triggers
22
        Column {
23
            spacing: 18
24
            Label { text: "Triggers For Return Home"; color: palette.text; font.pointSize: 20 }
25 26 27 28
            Row {
                Label {
                    width: leftColWidth
                    text: "RC Transmitter Signal Loss - Return Home After"
29
                    color: palette.text
30 31 32 33 34 35 36 37
                    anchors.baseline: rcLossField.baseline
                }
                FactTextField {
                    id: rcLossField
                    fact: autopilot.parameters["COM_RC_LOSS_T"]
                    showUnits: true
                }
            }
38
            Row {
39 40 41 42 43 44
                FactCheckBox {
                    id: telemetryLossCheckbox
                    fact: autopilot.parameters["COM_DL_LOSS_EN"]
                    width: leftColWidth
                    checkedValue: 1
                    uncheckedValue: 0
45
                    text: "Telemetry Signal Timeout - Return Home After"
46 47 48 49
                    anchors.baseline: telemetryLossField.baseline
                }
                FactTextField {
                    id: telemetryLossField
50
                    fact: autopilot.parameters["COM_DL_LOSS_T"];
51 52
                    showUnits: true
                }
53
            }
54 55 56 57 58
        }
        //-----------------------------------------------------------------
        //-- Return Home Options
        Column {
            spacing: 18
59
            Label { text: "Return Home Options"; color: palette.text; font.pointSize: 20 }
60 61 62 63
            Row {
                Label {
                    width: leftColWidth
                    text: "Climb to minimum altitude of "
64
                    color: palette.text
65 66 67 68 69 70 71
                    anchors.baseline: climbField.baseline
                }
                FactTextField {
                    id: climbField
                    fact: autopilot.parameters["RTL_RETURN_ALT"]
                    showUnits: true
                }
72 73 74 75 76
            }
            Row {
                CheckBox {
                    id: homeLoiterCheckbox
                    property Fact fact: autopilot.parameters["RTL_LAND_DELAY"]
77
                    width: leftColWidth
78
                    checked: fact.value > 0
79 80 81 82 83 84
                    text: "Loiter at Home altitude for "
                    onClicked: {
                        fact.value = checked ? 60 : -1
                    }
                    style: CheckBoxStyle {
                        label: Text {
85
                            color: palette.text
86 87 88 89 90 91 92 93
                            text: control.text
                        }
                    }
                }
                FactTextField {
                    fact: autopilot.parameters["RTL_LAND_DELAY"];
                    showUnits: true
                    anchors.baseline: homeLoiterCheckbox.baseline
94
                    enabled: homeLoiterCheckbox.checked == true
95 96
                }
            }
97 98 99 100
            //-------------------------------------------------------------
            //-- 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.
101
            Row {
102 103 104
                Label {
                    width: leftColWidth;
                    text: "When Home is reached, loiter at an altitude of ";
105
                    color: palette.text;
106 107
                    anchors.baseline: descendField.baseline
                    visible: homeLoiterCheckbox.checked == true
108 109
                }
                FactTextField {
110 111 112
                    id: descendField;
                    fact: autopilot.parameters["RTL_DESCEND_ALT"];
                    visible: homeLoiterCheckbox.checked == true
113 114 115 116 117 118 119
                    showUnits: true
                }
            }
        }

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