SafetyComponent.qml 33.2 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

Don Gagne's avatar
Don Gagne committed
17 18 19 20
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
21
import QGroundControl.Palette       1.0
Don Gagne's avatar
Don Gagne committed
22

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

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

33 34 35 36
            FactPanelController {
                id:         controller
            }

37 38
            readonly property string hitlParam: "SYS_HITL"

39
            property real _margins:         ScreenTools.defaultFontPixelHeight
Gus Grubba's avatar
Gus Grubba committed
40 41
            property real _labelWidth:      ScreenTools.defaultFontPixelWidth  * 30
            property real _editFieldWidth:  ScreenTools.defaultFontPixelWidth  * 24
Don Gagne's avatar
Don Gagne committed
42
            property real _imageHeight:     ScreenTools.defaultFontPixelHeight * 3
Gus Grubba's avatar
Gus Grubba committed
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
            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
63
                anchors.horizontalCenter:   parent.horizontalCenter
64

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

Gus Grubba's avatar
Gus Grubba committed
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
                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
                            }
104

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

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

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

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

Gus Grubba's avatar
Gus Grubba committed
139 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
                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
173
                                currentIndex:       _collisionPrevention ? (_collisionPrevention.rawValue > 0 ? 1 : 0) : 0
Gus Grubba's avatar
Gus Grubba committed
174 175 176
                                onActivated: {
                                    if(_collisionPrevention) {
                                        _collisionPrevention.value = index > 0 ? 5 : -1
Gus Grubba's avatar
Gus Grubba committed
177
                                        console.log('Collision prevention enabled: ' + _collisionPrevention.value)
Gus Grubba's avatar
Gus Grubba committed
178 179 180
                                    }
                                }
                            }
181

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

Gus Grubba's avatar
Gus Grubba committed
199 200 201 202 203 204 205
                            QGCLabel {
                                text:               qsTr("Minimum Distance:")
                                Layout.fillWidth:   true
                                Layout.alignment:   Qt.AlignVCenter
                            }
                            QGCSlider {
                                width:              _editFieldWidth
Gus Grubba's avatar
Gus Grubba committed
206
                                enabled:            _collisionPrevention && _collisionPrevention.rawValue > 0
Gus Grubba's avatar
Gus Grubba committed
207 208 209 210
                                Layout.minimumWidth:_editFieldWidth
                                Layout.minimumHeight:   ScreenTools.defaultFontPixelHeight * 2
                                Layout.fillWidth:   true
                                Layout.fillHeight:  true
Gus Grubba's avatar
Gus Grubba committed
211 212
                                maximumValue:       15
                                minimumValue:       0
Gus Grubba's avatar
Gus Grubba committed
213 214 215 216
                                stepSize:           1
                                displayValue:       true
                                updateValueWhileDragging:   false
                                Layout.alignment:   Qt.AlignVCenter
Gus Grubba's avatar
Gus Grubba committed
217 218 219
                                //-- Looking at raw value on purpose. I don't know how to handle the
                                //   slider range when not using metric system.
                                value:              (_collisionPrevention && _collisionPrevention.rawValue > 0) ? _collisionPrevention.rawValue : 0
Gus Grubba's avatar
Gus Grubba committed
220 221
                                onValueChanged: {
                                    if(_collisionPrevention) {
Gus Grubba's avatar
Gus Grubba committed
222 223 224 225
                                        //-- Negative means disabled
                                        if(_collisionPrevention.rawValue >= 0) {
                                            _collisionPrevention.rawValue = value
                                        }
Gus Grubba's avatar
Gus Grubba committed
226 227 228 229
                                    }
                                }
                            }
                        }
Don Gagne's avatar
Don Gagne committed
230
                    }
231
                }
232

233
                QGCLabel {
Gus Grubba's avatar
Gus Grubba committed
234
                    text:                   qsTr("RC Loss Failsafe Trigger")
235
                }
236

Gus Grubba's avatar
Gus Grubba committed
237 238 239 240 241 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
                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
                            }
272

Gus Grubba's avatar
Gus Grubba committed
273 274 275 276 277 278 279 280 281
                            QGCLabel {
                                text:               qsTr("RC Loss Timeout:")
                                Layout.fillWidth:   true
                            }
                            FactTextField {
                                fact:               controller.getParameterFact(-1, "COM_RC_LOSS_T")
                                Layout.fillWidth:   true
                            }
                        }
282 283
                    }
                }
284

285
                QGCLabel {
Gus Grubba's avatar
Gus Grubba committed
286
                    text:                   qsTr("Data Link Loss Failsafe Trigger")
287
                }
288

Gus Grubba's avatar
Gus Grubba committed
289 290 291 292 293 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
                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
                            }
324

Gus Grubba's avatar
Gus Grubba committed
325 326 327 328 329 330 331 332 333
                            QGCLabel {
                                text:               qsTr("Data Link Loss Timeout:")
                                Layout.fillWidth:   true
                            }
                            FactTextField {
                                fact:               controller.getParameterFact(-1, "COM_DL_LOSS_T")
                                Layout.fillWidth:   true
                            }
                        }
334 335
                    }
                }
336

337
                QGCLabel {
Gus Grubba's avatar
Gus Grubba committed
338
                    text:                   qsTr("Geofence Failsafe Trigger")
339
                }
340

Gus Grubba's avatar
Gus Grubba committed
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
                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
                            }
                        }
361

Gus Grubba's avatar
Gus Grubba committed
362 363 364
                        GridLayout {
                            columns:                2
                            anchors.verticalCenter: parent.verticalCenter
365

Gus Grubba's avatar
Gus Grubba committed
366 367 368 369 370 371 372 373 374 375 376
                            QGCLabel {
                                text:               qsTr("Action on breach:")
                                Layout.minimumWidth:_labelWidth
                                Layout.fillWidth:   true
                            }
                            FactComboBox {
                                fact:               _fenceAction
                                indexModel:         false
                                Layout.minimumWidth:_editFieldWidth
                                Layout.fillWidth:   true
                            }
377

Gus Grubba's avatar
Gus Grubba committed
378 379 380 381 382 383 384 385 386 387 388 389
                            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
                            }
390

Gus Grubba's avatar
Gus Grubba committed
391 392 393 394 395 396 397 398 399 400 401 402 403
                            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
                            }
                        }
404 405
                    }
                }
406

407
                QGCLabel {
408
                    text:               qsTr("Return Home Settings")
409
                }
410

Gus Grubba's avatar
Gus Grubba committed
411 412 413 414
                Rectangle {
                    width:              mainRow.width         + (_margins * 2)
                    height:             returnHomeGrid.height + (_margins * 2)
                    color:              qgcPal.windowShade
415
                    Row {
Gus Grubba's avatar
Gus Grubba committed
416 417 418 419 420 421 422 423 424 425 426 427 428 429
                        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
                            }
430
                        }
Gus Grubba's avatar
Gus Grubba committed
431 432 433 434 435 436 437 438 439 440 441 442 443 444
                        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
                            }
445

Gus Grubba's avatar
Gus Grubba committed
446 447 448 449 450 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
                            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
                                }
                            }
480

Gus Grubba's avatar
Gus Grubba committed
481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500
                            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
                            }
                        }
501
                    }
502
                }
503

504
                QGCLabel {
505
                    text:               qsTr("Land Mode Settings")
506
                }
507

Gus Grubba's avatar
Gus Grubba committed
508 509 510 511 512 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
                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
                            }
545

Gus Grubba's avatar
Gus Grubba committed
546 547 548 549 550 551 552 553 554 555 556 557 558
                            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
                            }
                        }
559 560
                    }
                }
561

562
                QGCLabel {
563
                    text:               qsTr("Vehicle Telemetry Logging")
564 565
                }

Gus Grubba's avatar
Gus Grubba committed
566 567 568 569 570 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
                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
                                    }
                                }
607 608 609 610 611
                            }
                        }
                    }
                }

612 613 614 615 616
                QGCLabel {
                    text:               qsTr("Hardware in the Loop Simulation")
                    visible:            _hitlAvailable
                }

Gus Grubba's avatar
Gus Grubba committed
617 618 619 620 621 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
                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
                            }
                        }
653 654
                    }
                }
655 656 657 658
            }
        }
    }
}