SafetyComponent.qml 33.5 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.
 *
 ****************************************************************************/
9 10


11 12
import QtQuick                  2.3
import QtQuick.Controls         1.2
13
import QtQuick.Controls.Styles  1.4
14
import QtQuick.Layouts          1.2
Don Gagne's avatar
Don Gagne committed
15
import QtGraphicalEffects       1.0
16

Gus Grubba's avatar
Gus Grubba committed
17
import QGroundControl               1.0
Don Gagne's avatar
Don Gagne committed
18 19 20 21
import QGroundControl.FactSystem    1.0
import QGroundControl.FactControls  1.0
import QGroundControl.Controls      1.0
import QGroundControl.ScreenTools   1.0
Gus Grubba's avatar
Gus Grubba committed
22
import QGroundControl.Palette       1.0
Don Gagne's avatar
Don Gagne committed
23

24 25 26 27 28
SetupPage {
    id:             safetyPage
    pageComponent:  pageComponent
    Component {
        id: pageComponent
Don Gagne's avatar
Don Gagne committed
29

30
        Item {
Gus Grubba's avatar
Gus Grubba committed
31 32
            width:      Math.max(availableWidth, outerColumn.width)
            height:     outerColumn.height
Don Gagne's avatar
Don Gagne committed
33

34 35 36 37
            FactPanelController {
                id:         controller
            }

38 39
            readonly property string hitlParam: "SYS_HITL"

40
            property real _margins:         ScreenTools.defaultFontPixelHeight
Gus Grubba's avatar
Gus Grubba committed
41 42
            property real _labelWidth:      ScreenTools.defaultFontPixelWidth  * 30
            property real _editFieldWidth:  ScreenTools.defaultFontPixelWidth  * 24
Don Gagne's avatar
Don Gagne committed
43
            property real _imageHeight:     ScreenTools.defaultFontPixelHeight * 3
Gus Grubba's avatar
Gus Grubba committed
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
            property real _imageWidth:      _imageHeight * 2

            property Fact _enableLogging:       controller.getParameterFact(-1, "SDLOG_MODE")
            property Fact _fenceAction:         controller.getParameterFact(-1, "GF_ACTION")
            property Fact _fenceRadius:         controller.getParameterFact(-1, "GF_MAX_HOR_DIST")
            property Fact _fenceAlt:            controller.getParameterFact(-1, "GF_MAX_VER_DIST")
            property Fact _rtlLandDelay:        controller.getParameterFact(-1, "RTL_LAND_DELAY")
            property Fact _lowBattAction:       controller.getParameterFact(-1, "COM_LOW_BAT_ACT")
            property Fact _rcLossAction:        controller.getParameterFact(-1, "NAV_RCL_ACT")
            property Fact _dlLossAction:        controller.getParameterFact(-1, "NAV_DLL_ACT")
            property Fact _disarmLandDelay:     controller.getParameterFact(-1, "COM_DISARM_LAND")
            property Fact _collisionPrevention: controller.getParameterFact(-1, "MPC_COL_PREV_D")
            property Fact _objectAvoidance:     controller.getParameterFact(-1, "COM_OBS_AVOID")
            property Fact _landSpeedMC:         controller.getParameterFact(-1, "MPC_LAND_SPEED", false)
            property bool _hitlAvailable:       controller.parameterExists(-1, hitlParam)
            property Fact _hitlEnabled:         controller.getParameterFact(-1, hitlParam, false)

            ColumnLayout {
                id:         outerColumn
                spacing:    _margins
64
                anchors.horizontalCenter:   parent.horizontalCenter
65

66
                QGCLabel {
Gus Grubba's avatar
Gus Grubba committed
67
                    text:                   qsTr("Low Battery Failsafe Trigger")
68
                }
69

Gus Grubba's avatar
Gus Grubba committed
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
                Rectangle {
                    width:                  mainRow.width  + (_margins * 2)
                    height:                 mainRow.height + (_margins * 2)
                    color:                  qgcPal.windowShade
                    Row {
                        id:                 mainRow
                        spacing:            _margins
                        anchors.centerIn:   parent
                        Item {
                            width:                  _imageWidth
                            height:                 _imageHeight
                            anchors.verticalCenter: parent.verticalCenter
                            Image {
                                mipmap:             true
                                fillMode:           Image.PreserveAspectFit
                                source:             qgcPal.globalTheme === QGCPalette.Light ? "/qmlimages/LowBatteryLight.svg" : "/qmlimages/LowBattery.svg"
                                height:             _imageHeight
                                anchors.centerIn:   parent
                            }
                        }
                        GridLayout {
                            columns:                2
                            anchors.verticalCenter: parent.verticalCenter

                            QGCLabel {
                                text:               qsTr("Failsafe Action:")
                                Layout.minimumWidth:_labelWidth
                                Layout.fillWidth:   true
                            }
                            FactComboBox {
                                fact:               _lowBattAction
                                indexModel:         false
                                Layout.minimumWidth:_editFieldWidth
                                Layout.fillWidth:   true
                            }
105

Gus Grubba's avatar
Gus Grubba committed
106 107 108 109 110 111 112 113
                            QGCLabel {
                                text:               qsTr("Battery Warn Level:")
                                Layout.fillWidth:   true
                            }
                            FactTextField {
                                fact:               controller.getParameterFact(-1, "BAT_LOW_THR")
                                Layout.fillWidth:   true
                            }
114

Gus Grubba's avatar
Gus Grubba committed
115 116 117 118 119 120 121 122
                            QGCLabel {
                                text:               qsTr("Battery Failsafe Level:")
                                Layout.fillWidth:   true
                            }
                            FactTextField {
                                fact:               controller.getParameterFact(-1, "BAT_CRIT_THR")
                                Layout.fillWidth:   true
                            }
123

Gus Grubba's avatar
Gus Grubba committed
124 125 126 127 128 129 130 131 132
                            QGCLabel {
                                text:               qsTr("Battery Emergency Level:")
                                Layout.fillWidth:   true
                            }
                            FactTextField {
                                fact:               controller.getParameterFact(-1, "BAT_EMERGEN_THR")
                                Layout.fillWidth:   true
                            }
                        }
133
                    }
Gus Grubba's avatar
Gus Grubba committed
134
                }
135

Gus Grubba's avatar
Gus Grubba committed
136 137 138
                QGCLabel {
                    text:                   qsTr("Object Detection")
                }
139

Gus Grubba's avatar
Gus Grubba committed
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
                Rectangle {
                    width:                  mainRow.width + (_margins * 2)
                    height:                 odRow.height  + (_margins * 2)
                    color:                  qgcPal.windowShade
                    Row {
                        id:                 odRow
                        spacing:            _margins
                        anchors.centerIn:   parent
                        Item {
                            width:                  _imageWidth
                            height:                 _imageHeight
                            anchors.verticalCenter: parent.verticalCenter
                            QGCColoredImage {
                                color:              qgcPal.text
                                source:             "/qmlimages/ObjectAvoidance.svg"
                                height:             _imageHeight
                                width:              _imageHeight * 2
                                anchors.centerIn:   parent
                            }
                        }
                        GridLayout {
                            columns:                2
                            anchors.verticalCenter: parent.verticalCenter

                            QGCLabel {
                                text:               qsTr("Collision Prevention:")
                                Layout.minimumWidth:_labelWidth
                                Layout.fillWidth:   true
                            }
                            QGCComboBox {
                                model:              [qsTr("Disabled"), qsTr("Enabled")]
                                enabled:            _collisionPrevention
                                Layout.minimumWidth:_editFieldWidth
                                Layout.fillWidth:   true
Gus Grubba's avatar
Gus Grubba committed
174
                                currentIndex:       _collisionPrevention ? (_collisionPrevention.rawValue > 0 ? 1 : 0) : 0
Gus Grubba's avatar
Gus Grubba committed
175 176 177
                                onActivated: {
                                    if(_collisionPrevention) {
                                        _collisionPrevention.value = index > 0 ? 5 : -1
Gus Grubba's avatar
Gus Grubba committed
178
                                        console.log('Collision prevention enabled: ' + _collisionPrevention.value)
Gus Grubba's avatar
Gus Grubba committed
179 180 181
                                    }
                                }
                            }
182

Gus Grubba's avatar
Gus Grubba committed
183 184 185 186 187 188
                            QGCLabel {
                                text:               qsTr("Obstacle Avoidance:")
                                Layout.fillWidth:   true
                            }
                            QGCComboBox {
                                model:              [qsTr("Disabled"), qsTr("Enabled")]
Gus Grubba's avatar
Gus Grubba committed
189
                                enabled:            _objectAvoidance && _collisionPrevention.rawValue > 0
Gus Grubba's avatar
Gus Grubba committed
190 191
                                Layout.minimumWidth:_editFieldWidth
                                Layout.fillWidth:   true
Gus Grubba's avatar
Gus Grubba committed
192
                                currentIndex:       _objectAvoidance ? (_objectAvoidance.value === 0 ? 0 : 1) : 0
Gus Grubba's avatar
Gus Grubba committed
193 194 195 196 197 198
                                onActivated: {
                                    if(_objectAvoidance) {
                                        _objectAvoidance.value = index > 0 ? 1 : 0
                                    }
                                }
                            }
Don Gagne's avatar
Don Gagne committed
199

Gus Grubba's avatar
Gus Grubba committed
200
                            QGCLabel {
Gus Grubba's avatar
Gus Grubba committed
201
                                text:               qsTr("Minimum Distance: (") + QGroundControl.appSettingsDistanceUnitsString + ")"
Gus Grubba's avatar
Gus Grubba committed
202 203 204 205 206
                                Layout.fillWidth:   true
                                Layout.alignment:   Qt.AlignVCenter
                            }
                            QGCSlider {
                                width:              _editFieldWidth
Gus Grubba's avatar
Gus Grubba committed
207
                                enabled:            _collisionPrevention && _collisionPrevention.rawValue > 0
Gus Grubba's avatar
Gus Grubba committed
208 209 210 211
                                Layout.minimumWidth:_editFieldWidth
                                Layout.minimumHeight:   ScreenTools.defaultFontPixelHeight * 2
                                Layout.fillWidth:   true
                                Layout.fillHeight:  true
Gus Grubba's avatar
Gus Grubba committed
212 213
                                maximumValue:       QGroundControl.metersToAppSettingsDistanceUnits(15)
                                minimumValue:       QGroundControl.metersToAppSettingsDistanceUnits(1)
Gus Grubba's avatar
Gus Grubba committed
214 215 216 217
                                stepSize:           1
                                displayValue:       true
                                updateValueWhileDragging:   false
                                Layout.alignment:   Qt.AlignVCenter
Gus Grubba's avatar
Gus Grubba committed
218 219 220 221 222 223 224
                                value: {
                                    if (_collisionPrevention && _collisionPrevention.rawValue > 0) {
                                        return QGroundControl.metersToAppSettingsDistanceUnits(_collisionPrevention.rawValue)
                                    } else {
                                        return 1;
                                    }
                                }
Gus Grubba's avatar
Gus Grubba committed
225 226
                                onValueChanged: {
                                    if(_collisionPrevention) {
Gus Grubba's avatar
Gus Grubba committed
227 228
                                        //-- Negative means disabled
                                        if(_collisionPrevention.rawValue >= 0) {
Gus Grubba's avatar
Gus Grubba committed
229
                                            _collisionPrevention.rawValue = QGroundControl.appSettingsDistanceUnitsToMeters(value)
Gus Grubba's avatar
Gus Grubba committed
230
                                        }
Gus Grubba's avatar
Gus Grubba committed
231 232 233 234
                                    }
                                }
                            }
                        }
Don Gagne's avatar
Don Gagne committed
235
                    }
236
                }
237

238
                QGCLabel {
Gus Grubba's avatar
Gus Grubba committed
239
                    text:                   qsTr("RC Loss Failsafe Trigger")
240
                }
241

Gus Grubba's avatar
Gus Grubba committed
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276
                Rectangle {
                    width:                  mainRow.width     + (_margins * 2)
                    height:                 rcLossGrid.height + (_margins * 2)
                    color:                  qgcPal.windowShade
                    Row {
                        id:                 rcLossGrid
                        spacing:            _margins
                        anchors.centerIn:   parent
                        Item {
                            width:                  _imageWidth
                            height:                 _imageHeight
                            anchors.verticalCenter: parent.verticalCenter
                            Image {
                                mipmap:             true
                                fillMode:           Image.PreserveAspectFit
                                source:             qgcPal.globalTheme === QGCPalette.Light ? "/qmlimages/RCLossLight.svg" : "/qmlimages/RCLoss.svg"
                                height:             _imageHeight
                                anchors.centerIn:   parent
                            }
                        }
                        GridLayout {
                            columns:                2
                            anchors.verticalCenter: parent.verticalCenter

                            QGCLabel {
                                text:               qsTr("Failsafe Action:")
                                Layout.minimumWidth:_labelWidth
                                Layout.fillWidth:   true
                            }
                            FactComboBox {
                                fact:               _rcLossAction
                                indexModel:         false
                                Layout.minimumWidth:_editFieldWidth
                                Layout.fillWidth:   true
                            }
277

Gus Grubba's avatar
Gus Grubba committed
278 279 280 281 282 283 284 285 286
                            QGCLabel {
                                text:               qsTr("RC Loss Timeout:")
                                Layout.fillWidth:   true
                            }
                            FactTextField {
                                fact:               controller.getParameterFact(-1, "COM_RC_LOSS_T")
                                Layout.fillWidth:   true
                            }
                        }
287 288
                    }
                }
289

290
                QGCLabel {
Gus Grubba's avatar
Gus Grubba committed
291
                    text:                   qsTr("Data Link Loss Failsafe Trigger")
292
                }
293

Gus Grubba's avatar
Gus Grubba committed
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328
                Rectangle {
                    width:                  mainRow.width           + (_margins * 2)
                    height:                 dataLinkLossGrid.height + (_margins * 2)
                    color:                  qgcPal.windowShade
                    Row {
                        id:                 dataLinkLossGrid
                        spacing:            _margins
                        anchors.centerIn:   parent
                        Item {
                            width:                  _imageWidth
                            height:                 _imageHeight
                            anchors.verticalCenter: parent.verticalCenter
                            Image {
                                mipmap:             true
                                fillMode:           Image.PreserveAspectFit
                                source:             qgcPal.globalTheme === QGCPalette.Light ? "/qmlimages/DatalinkLossLight.svg" : "/qmlimages/DatalinkLoss.svg"
                                height:             _imageHeight
                                anchors.centerIn:   parent
                            }
                        }
                        GridLayout {
                            columns:                2
                            anchors.verticalCenter: parent.verticalCenter

                            QGCLabel {
                                text:               qsTr("Failsafe Action:")
                                Layout.minimumWidth:_labelWidth
                                Layout.fillWidth:   true
                            }
                            FactComboBox {
                                fact:               _dlLossAction
                                indexModel:         false
                                Layout.minimumWidth:_editFieldWidth
                                Layout.fillWidth:   true
                            }
329

Gus Grubba's avatar
Gus Grubba committed
330 331 332 333 334 335 336 337 338
                            QGCLabel {
                                text:               qsTr("Data Link Loss Timeout:")
                                Layout.fillWidth:   true
                            }
                            FactTextField {
                                fact:               controller.getParameterFact(-1, "COM_DL_LOSS_T")
                                Layout.fillWidth:   true
                            }
                        }
339 340
                    }
                }
341

342
                QGCLabel {
Gus Grubba's avatar
Gus Grubba committed
343
                    text:                   qsTr("Geofence Failsafe Trigger")
344
                }
345

Gus Grubba's avatar
Gus Grubba committed
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365
                Rectangle {
                    width:                  mainRow.width       + (_margins * 2)
                    height:                 geoFenceGrid.height + (_margins * 2)
                    color:                  qgcPal.windowShade
                    Row {
                        id:                 geoFenceGrid
                        spacing:            _margins
                        anchors.centerIn:   parent
                        Item {
                            width:                  _imageWidth
                            height:                 _imageHeight
                            anchors.verticalCenter: parent.verticalCenter
                            Image {
                                mipmap:             true
                                fillMode:           Image.PreserveAspectFit
                                source:             qgcPal.globalTheme === QGCPalette.Light ? "/qmlimages/GeoFenceLight.svg" : "/qmlimages/GeoFence.svg"
                                height:             _imageHeight
                                anchors.centerIn:   parent
                            }
                        }
366

Gus Grubba's avatar
Gus Grubba committed
367 368 369
                        GridLayout {
                            columns:                2
                            anchors.verticalCenter: parent.verticalCenter
370

Gus Grubba's avatar
Gus Grubba committed
371 372 373 374 375 376 377 378 379 380 381
                            QGCLabel {
                                text:               qsTr("Action on breach:")
                                Layout.minimumWidth:_labelWidth
                                Layout.fillWidth:   true
                            }
                            FactComboBox {
                                fact:               _fenceAction
                                indexModel:         false
                                Layout.minimumWidth:_editFieldWidth
                                Layout.fillWidth:   true
                            }
382

Gus Grubba's avatar
Gus Grubba committed
383 384 385 386 387 388 389 390 391 392 393 394
                            QGCCheckBox {
                                id:                 fenceRadiusCheckBox
                                text:               qsTr("Max Radius:")
                                checked:            _fenceRadius.value > 0
                                onClicked:          _fenceRadius.value = checked ? 100 : 0
                                Layout.fillWidth:   true
                            }
                            FactTextField {
                                fact:               _fenceRadius
                                enabled:            fenceRadiusCheckBox.checked
                                Layout.fillWidth:   true
                            }
395

Gus Grubba's avatar
Gus Grubba committed
396 397 398 399 400 401 402 403 404 405 406 407 408
                            QGCCheckBox {
                                id:                 fenceAltMaxCheckBox
                                text:               qsTr("Max Altitude:")
                                checked:            _fenceAlt ? _fenceAlt.value > 0 : false
                                onClicked:          _fenceAlt.value = checked ? 100 : 0
                                Layout.fillWidth:   true
                            }
                            FactTextField {
                                fact:               _fenceAlt
                                enabled:            fenceAltMaxCheckBox.checked
                                Layout.fillWidth:   true
                            }
                        }
409 410
                    }
                }
411

412
                QGCLabel {
413
                    text:               qsTr("Return Home Settings")
414
                }
415

Gus Grubba's avatar
Gus Grubba committed
416 417 418 419
                Rectangle {
                    width:              mainRow.width         + (_margins * 2)
                    height:             returnHomeGrid.height + (_margins * 2)
                    color:              qgcPal.windowShade
420
                    Row {
Gus Grubba's avatar
Gus Grubba committed
421 422 423 424 425 426 427 428 429 430 431 432 433 434
                        id:                 returnHomeGrid
                        spacing:            _margins
                        anchors.centerIn:   parent
                        Item {
                            width:                  _imageWidth
                            height:                 _imageHeight
                            anchors.verticalCenter: parent.verticalCenter
                            QGCColoredImage {
                                color:              qgcPal.text
                                source:             controller.vehicle.fixedWing ? "/qmlimages/ReturnToHomeAltitude.svg" : "/qmlimages/ReturnToHomeAltitudeCopter.svg"
                                height:             _imageHeight
                                width:              _imageHeight * 2
                                anchors.centerIn:   parent
                            }
435
                        }
Gus Grubba's avatar
Gus Grubba committed
436 437 438 439 440 441 442 443 444 445 446 447 448 449
                        GridLayout {
                            columns:                    2
                            anchors.verticalCenter:     parent.verticalCenter

                            QGCLabel {
                                text:                   qsTr("Climb to altitude of:")
                                Layout.minimumWidth:    _labelWidth
                                Layout.fillWidth:       true
                            }
                            FactTextField {
                                fact:                   controller.getParameterFact(-1, "RTL_RETURN_ALT")
                                Layout.minimumWidth:    _editFieldWidth
                                Layout.fillWidth:       true
                            }
450

Gus Grubba's avatar
Gus Grubba committed
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484
                            QGCLabel {
                                text:                   qsTr("Return home, then:")
                                Layout.columnSpan:      2
                            }
                            Row {
                                Layout.columnSpan:      2
                                Item { width: ScreenTools.defaultFontPixelWidth; height: 1 }
                                QGCRadioButton {
                                    id:                 homeLandRadio
                                    checked:            _rtlLandDelay ? _rtlLandDelay.value === 0 : false
                                    text:               qsTr("Land immediately")
                                    onClicked:          _rtlLandDelay.value = 0
                                }
                            }
                            Row {
                                Layout.columnSpan:      2
                                Item { width: ScreenTools.defaultFontPixelWidth; height: 1 }
                                QGCRadioButton {
                                    id:                 homeLoiterNoLandRadio
                                    checked:            _rtlLandDelay ? _rtlLandDelay.value < 0 : false
                                    text:               qsTr("Loiter and do not land")
                                    onClicked:          _rtlLandDelay.value = -1
                                }
                            }
                            Row {
                                Layout.columnSpan:      2
                                Item { width: ScreenTools.defaultFontPixelWidth; height: 1 }
                                QGCRadioButton {
                                    id:                 homeLoiterLandRadio
                                    checked:            _rtlLandDelay ? _rtlLandDelay.value > 0 : false
                                    text:               qsTr("Loiter and land after specified time")
                                    onClicked:          _rtlLandDelay.value = 60
                                }
                            }
485

Gus Grubba's avatar
Gus Grubba committed
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505
                            QGCLabel {
                                text:                   qsTr("Loiter Time")
                                Layout.fillWidth:       true
                            }
                            FactTextField {
                                fact:                   controller.getParameterFact(-1, "RTL_LAND_DELAY")
                                enabled:                homeLoiterLandRadio.checked === true
                                Layout.fillWidth:       true
                            }

                            QGCLabel {
                                text:                   qsTr("Loiter Altitude")
                                Layout.fillWidth:       true
                            }
                            FactTextField {
                                fact:                   controller.getParameterFact(-1, "RTL_DESCEND_ALT")
                                enabled:                homeLoiterLandRadio.checked === true || homeLoiterNoLandRadio.checked === true
                                Layout.fillWidth:       true
                            }
                        }
506
                    }
507
                }
508

509
                QGCLabel {
510
                    text:               qsTr("Land Mode Settings")
511
                }
512

Gus Grubba's avatar
Gus Grubba committed
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549
                Rectangle {
                    width:              mainRow.width       + (_margins * 2)
                    height:             landModeGrid.height + (_margins * 2)
                    color:              qgcPal.windowShade
                    Row {
                        id:                 landModeGrid
                        spacing:            _margins
                        anchors.centerIn:   parent
                        Item {
                            width:                  _imageWidth
                            height:                 _imageHeight
                            anchors.verticalCenter: parent.verticalCenter
                            QGCColoredImage {
                                color:              qgcPal.text
                                source:             controller.vehicle.fixedWing ? "/qmlimages/LandMode.svg" : "/qmlimages/LandModeCopter.svg"
                                height:             _imageHeight
                                width:              _imageHeight
                                anchors.centerIn:   parent
                            }
                        }
                        GridLayout {
                            columns:                2
                            anchors.verticalCenter: parent.verticalCenter

                            QGCLabel {
                                id:                 landVelocityLabel
                                text:               qsTr("Landing Descent Rate:")
                                visible:            controller.vehicle && !controller.vehicle.fixedWing
                                Layout.minimumWidth:_labelWidth
                                Layout.fillWidth:   true
                            }
                            FactTextField {
                                fact:               _landSpeedMC
                                visible:            controller.vehicle && !controller.vehicle.fixedWing
                                Layout.minimumWidth:_editFieldWidth
                                Layout.fillWidth:   true
                            }
550

Gus Grubba's avatar
Gus Grubba committed
551 552 553 554 555 556 557 558 559 560 561 562 563
                            QGCCheckBox {
                                id:                 disarmDelayCheckBox
                                text:               qsTr("Disarm After:")
                                checked:            _disarmLandDelay.value > 0
                                onClicked:          _disarmLandDelay.value = checked ? 2 : 0
                                Layout.fillWidth:   true
                            }
                            FactTextField {
                                fact:               _disarmLandDelay
                                enabled:            disarmDelayCheckBox.checked
                                Layout.fillWidth:   true
                            }
                        }
564 565
                    }
                }
566

567
                QGCLabel {
568
                    text:               qsTr("Vehicle Telemetry Logging")
569 570
                }

Gus Grubba's avatar
Gus Grubba committed
571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611
                Rectangle {
                    width:              mainRow.width      + (_margins * 2)
                    height:             loggingGrid.height + (_margins * 2)
                    color:              qgcPal.windowShade
                    Row {
                        id:                 loggingGrid
                        spacing:            _margins
                        anchors.centerIn:   parent
                        Item {
                            width:                  _imageWidth
                            height:                 _imageHeight
                            anchors.verticalCenter: parent.verticalCenter
                            Image {
                                mipmap:             true
                                fillMode:           Image.PreserveAspectFit
                                source:             qgcPal.globalTheme === QGCPalette.Light ? "/qmlimages/no-logging-light.svg" : "/qmlimages/no-logging.svg"
                                height:             _imageHeight
                                anchors.centerIn:   parent
                            }
                        }
                        GridLayout {
                            columns:                2
                            anchors.verticalCenter: parent.verticalCenter
                            QGCLabel {
                                text:               qsTr("Telemetry logging to vehicle storage:")
                                Layout.minimumWidth:_labelWidth
                                Layout.fillWidth:   true
                            }
                            QGCComboBox {
                                model:              [qsTr("Disabled"), qsTr("Enabled")]
                                enabled:            _enableLogging
                                Layout.minimumWidth:_editFieldWidth
                                Layout.fillWidth:   true
                                Component.onCompleted: {
                                    currentIndex = _enableLogging ? (_enableLogging.value >= 0 ? 1 : 0) : 0
                                }
                                onActivated: {
                                    if(_enableLogging) {
                                        _enableLogging.value = index > 0 ? 0 : -1
                                    }
                                }
612 613 614 615 616
                            }
                        }
                    }
                }

617 618 619 620 621
                QGCLabel {
                    text:               qsTr("Hardware in the Loop Simulation")
                    visible:            _hitlAvailable
                }

Gus Grubba's avatar
Gus Grubba committed
622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657
                Rectangle {
                    width:              mainRow.width   + (_margins * 2)
                    height:             hitlGrid.height + (_margins * 2)
                    color:              qgcPal.windowShade
                    visible:            _hitlAvailable
                    Row {
                        id:                 hitlGrid
                        spacing:            _margins
                        anchors.centerIn:   parent
                        Item {
                            width:                  _imageWidth
                            height:                 _imageHeight
                            anchors.verticalCenter: parent.verticalCenter
                            QGCColoredImage {
                                color:              qgcPal.text
                                source:             "/qmlimages/HITL.svg"
                                height:             _imageHeight
                                width:              _imageHeight
                                anchors.centerIn:   parent
                            }
                        }
                        GridLayout {
                            columns:                2
                            anchors.verticalCenter: parent.verticalCenter
                            QGCLabel {
                                text:               qsTr("HITL Enabled:")
                                Layout.minimumWidth:_labelWidth
                                Layout.fillWidth:   true
                            }
                            FactComboBox {
                                fact:               _hitlEnabled
                                indexModel:         false
                                Layout.minimumWidth:_editFieldWidth
                                Layout.fillWidth:   true
                            }
                        }
658 659
                    }
                }
660 661 662 663
            }
        }
    }
}