APMSensorsComponent.qml 29.9 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.
 *
 ****************************************************************************/
Don Gagne's avatar
Don Gagne committed
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23


import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QtQuick.Dialogs 1.2

import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controllers 1.0

QGCView {
24
    id:         qgcView
Don Gagne's avatar
Don Gagne committed
25 26 27 28 29
    viewPanel:  panel

    // Help text which is shown both in the status text area prior to pressing a cal button and in the
    // pre-calibration dialog.

Don Gagne's avatar
Don Gagne committed
30 31
    readonly property string orientationHelpSet:    "If the orientation is in the direction of flight, select None."
    readonly property string orientationHelpCal:    "Before calibrating make sure orientation settings are correct. " + orientationHelpSet
32
    readonly property string compassRotationText:   "If the compass or GPS module is mounted in flight direction, leave the default value (None)"
Don Gagne's avatar
Don Gagne committed
33

Don Gagne's avatar
Don Gagne committed
34
    readonly property string compassHelp:   "For Compass calibration you will need to rotate your vehicle through a number of positions."
Don Gagne's avatar
Don Gagne committed
35 36 37 38 39
    readonly property string gyroHelp:      "For Gyroscope calibration you will need to place your vehicle on a surface and leave it still."
    readonly property string accelHelp:     "For Accelerometer calibration you will need to place your vehicle on all six sides on a perfectly level surface and hold it still in each orientation for a few seconds."
    readonly property string levelHelp:     "To level the horizon you need to place the vehicle in its level flight position and press OK."
    readonly property string airspeedHelp:  "For Airspeed calibration you will need to keep your airspeed sensor out of any wind and then blow across the sensor."

Don Gagne's avatar
Don Gagne committed
40
    readonly property string statusTextAreaDefaultText: "Start the individual calibration steps by clicking one of the buttons to the left."
Don Gagne's avatar
Don Gagne committed
41 42 43 44

    // Used to pass help text to the preCalibrationDialog dialog
    property string preCalibrationDialogHelp

Don Gagne's avatar
Don Gagne committed
45 46 47 48 49 50
    property string _postCalibrationDialogText
    property var    _postCalibrationDialogParams

    readonly property string _badCompassCalText: "The calibration for Compass %1 appears to be poor. " +
                                                 "Check the compass position within your vehicle and re-do the calibration."

51 52
    readonly property int sideBarH1PointSize:  ScreenTools.mediumFontPointSize
    readonly property int mainTextH1PointSize: ScreenTools.mediumFontPointSize // Seems to be unused
Don Gagne's avatar
Don Gagne committed
53 54

    readonly property int rotationColumnWidth: 250
55

Don Gagne's avatar
Don Gagne committed
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 86 87 88 89 90 91 92 93
    property Fact compass1Id:           controller.getParameterFact(-1, "COMPASS_DEV_ID")
    property Fact compass2Id:           controller.getParameterFact(-1, "COMPASS_DEV_ID2")
    property Fact compass3Id:           controller.getParameterFact(-1, "COMPASS_DEV_ID3")
    property Fact compass1ExternalFact: controller.getParameterFact(-1, "COMPASS_EXTERNAL")
    property Fact compass1Rot:          controller.getParameterFact(-1, "COMPASS_ORIENT")

    property Fact boardRot:             controller.getParameterFact(-1, "AHRS_ORIENTATION")

    property bool accelCalNeeded:       controller.accelSetupNeeded
    property bool compassCalNeeded:     controller.compassSetupNeeded


    // The following parameters are not available in olders firmwares

    property bool compass2ExternalParamAvailable:   controller.parameterExists(-1, "COMPASS_EXTERN2")
    property bool compass3ExternalParamAvailable:   controller.parameterExists(-1, "COMPASS_EXTERN3")
    property bool compass2RotParamAvailable:        controller.parameterExists(-1, "COMPASS_ORIENT2")
    property bool compass3RotParamAvailable:        controller.parameterExists(-1, "COMPASS_ORIENT3")
    property bool compass1UseParamAvailable:        controller.parameterExists(-1, "COMPASS_USE")
    property bool compass2UseParamAvailable:        controller.parameterExists(-1, "COMPASS_USE2")
    property bool compass3UseParamAvailable:        controller.parameterExists(-1, "COMPASS_USE3")

    property Fact noFact: Fact { }
    property Fact compass2ExternalFact: compass2ExternalParamAvailable ? controller.getParameterFact(-1, "COMPASS_EXTERN2") : noFact
    property Fact compass3ExternalFact: compass3ExternalParamAvailable ? controller.getParameterFact(-1, "COMPASS_EXTERN3") : noFact
    property Fact compass2Rot:          compass2RotParamAvailable ? controller.getParameterFact(-1, "COMPASS_ORIENT2") : noFact
    property Fact compass3Rot:          compass3RotParamAvailable ? controller.getParameterFact(-1, "COMPASS_ORIENT3") : noFact
    property Fact compass1UseFact:      compass1UseParamAvailable ? controller.getParameterFact(-1, "COMPASS_USE") : noFact
    property Fact compass2UseFact:      compass2UseParamAvailable ? controller.getParameterFact(-1, "COMPASS_USE2") : noFact
    property Fact compass3UseFact:      compass3UseParamAvailable ? controller.getParameterFact(-1, "COMPASS_USE3") : noFact

    // We track these values by binding through a separate property so we can handle missing params
    property bool compass1External: compass1ExternalFact.value
    property bool compass2External: compass2ExternalParamAvailable ? compass2ExternalFact.value : false // false: Simulate internal so we don't show rotation combos
    property bool compass3External: compass3ExternalParamAvailable ? compass3ExternalFact.value : false // false: Simulate internal so we don't show rotation combos
    property bool compass1Use:      compass1UseParamAvailable ? compass1UseFact.value : true
    property bool compass2Use:      compass2UseParamAvailable ? compass2UseFact.value : true
    property bool compass3Use:      compass3UseParamAvailable ? compass3UseFact.value : true
Don Gagne's avatar
Don Gagne committed
94 95

    // Id > = signals compass available, rot < 0 signals internal compass
96 97 98
    property bool showCompass1: compass1Id.value > 0
    property bool showCompass2: compass2Id.value > 0
    property bool showCompass3: compass3Id.value > 0
Don Gagne's avatar
Don Gagne committed
99

Don Gagne's avatar
Don Gagne committed
100 101 102 103 104 105 106 107
    readonly property int _calTypeCompass:  1   ///< Calibrate compass
    readonly property int _calTypeAccel:    2   ///< Calibrate accel
    readonly property int _calTypeSet:      3   ///< Set orientations only

    property bool   _orientationsDialogShowCompass: true
    property string _orientationDialogHelp:         orientationHelpSet
    property int    _orientationDialogCalType

Don Gagne's avatar
Don Gagne committed
108 109 110 111 112 113 114
    function validCompassOffsets(compassParamPrefix) {
        var ofsX = controller.getParameterFact(-1, compassParamPrefix + "X")
        var ofsY = controller.getParameterFact(-1, compassParamPrefix + "Y")
        var ofsZ = controller.getParameterFact(-1, compassParamPrefix + "Z")
        return Math.sqrt(ofsX.value^2 + ofsY.value^2 + ofsZ.value^2) < 600
    }

Don Gagne's avatar
Don Gagne committed
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
    function showOrientationsDialog(calType) {
        var dialogTitle
        var buttons = StandardButton.Ok

        _orientationDialogCalType = calType
        switch (calType) {
        case _calTypeCompass:
            _orientationsDialogShowCompass = true
            _orientationDialogHelp = orientationHelpCal
            dialogTitle = qsTr("Calibrate Compass")
            buttons |= StandardButton.Cancel
            break
        case _calTypeAccel:
            _orientationsDialogShowCompass = false
            _orientationDialogHelp = orientationHelpCal
            dialogTitle = qsTr("Calibrate Accelerometer")
            buttons |= StandardButton.Cancel
            break
        case _calTypeSet:
            _orientationsDialogShowCompass = true
            _orientationDialogHelp = orientationHelpSet
136
            dialogTitle = qsTr("Sensor Settings")
Don Gagne's avatar
Don Gagne committed
137 138 139 140 141 142
            break
        }

        showDialog(orientationsDialogComponent, dialogTitle, qgcView.showDialogDefaultWidth, buttons)
    }

Don Gagne's avatar
Don Gagne committed
143 144 145 146 147 148 149
    APMSensorsComponentController {
        id:                         controller
        factPanel:                  panel
        statusLog:                  statusTextArea
        progressBar:                progressBar
        compassButton:              compassButton
        accelButton:                accelButton
150
        compassMotButton:           motorInterferenceButton
Don Gagne's avatar
Don Gagne committed
151 152
        nextButton:                 nextButton
        cancelButton:               cancelButton
Don Gagne's avatar
Don Gagne committed
153
        setOrientationsButton:      setOrientationsButton
Don Gagne's avatar
Don Gagne committed
154 155 156 157 158 159
        orientationCalAreaHelpText: orientationCalAreaHelpText

        onResetStatusTextArea: statusLog.text = statusTextAreaDefaultText

        onWaitingForCancelChanged: {
            if (controller.waitingForCancel) {
160
                showMessage(qsTr("Calibration Cancel"), qsTr("Waiting for Vehicle to response to Cancel. This may take a few seconds."), 0)
Don Gagne's avatar
Don Gagne committed
161 162 163 164
            } else {
                hideDialog()
            }
        }
Don Gagne's avatar
Don Gagne committed
165 166

        onCalibrationComplete: {
Don Gagne's avatar
Don Gagne committed
167
            if (_orientationDialogCalType == _calTypeAccel) {
168
                _postCalibrationDialogText = qsTr("Accelerometer calibration complete.")
Don Gagne's avatar
Don Gagne committed
169 170 171 172 173 174
                _postCalibrationDialogParams = [ "INS_ACCSCAL_X", "INS_ACCSCAL_Y", "INS_ACCSCAL_Z",
                                                "INS_ACC2SCAL_X", "INS_ACC2SCAL_Y", "INS_ACC2SCAL_Z",
                                                "INS_ACC3SCAL_X", "INS_ACC3SCAL_Y", "INS_ACC3SCAL_Z",
                                                "INS_GYROFFS_X", "INS_GYROFFS_Y", "INS_GYROFFS_Z",
                                                "INS_GYR2OFFS_X", "INS_GYR2OFFS_Y", "INS_GYR2OFFS_Z",
                                                "INS_GYR3OFFS_X", "INS_GYR3OFFS_Y", "INS_GYR3OFFS_Z" ]
175
                showDialog(postCalibrationDialogComponent, qsTr("Calibration complete"), qgcView.showDialogDefaultWidth, StandardButton.Ok)
Don Gagne's avatar
Don Gagne committed
176
            } else if (_orientationDialogCalType == _calTypeCompass) {
177
                _postCalibrationDialogText = qsTr("Compass calibration complete. ")
Don Gagne's avatar
Don Gagne committed
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
                _postCalibrationDialogParams = [];
                if (compass1Id.value > 0) {
                    if (!validCompassOffsets("COMPASS_OFS_")) {
                        _postCalibrationDialogText += _badCompassCalText.replace("%1", 1)
                    }
                    _postCalibrationDialogParams.push("COMPASS_OFS_X")
                    _postCalibrationDialogParams.push("COMPASS_OFS_Y")
                    _postCalibrationDialogParams.push("COMPASS_OFS_Z")
                }
                if (compass2Id.value > 0) {
                    if (!validCompassOffsets("COMPASS_OFS_")) {
                        _postCalibrationDialogText += _badCompassCalText.replace("%1", 2)
                    }
                    _postCalibrationDialogParams.push("COMPASS_OFS2_X")
                    _postCalibrationDialogParams.push("COMPASS_OFS2_Y")
                    _postCalibrationDialogParams.push("COMPASS_OFS2_Z")
                }
                if (compass3Id.value > 0) {
                    if (!validCompassOffsets("COMPASS_OFS_")) {
                        _postCalibrationDialogText += _badCompassCalText.replace("%1", 3)
                    }
                    _postCalibrationDialogParams.push("COMPASS_OFS3_X")
                    _postCalibrationDialogParams.push("COMPASS_OFS3_Y")
                    _postCalibrationDialogParams.push("COMPASS_OFS3_Z")
                }
203
                showDialog(postCalibrationDialogComponent, qsTr("Calibration complete"), qgcView.showDialogDefaultWidth, StandardButton.Ok)
Don Gagne's avatar
Don Gagne committed
204 205
            }
        }
Don Gagne's avatar
Don Gagne committed
206 207
    }

Don Gagne's avatar
Don Gagne committed
208 209 210 211 212 213 214 215
    Component.onCompleted: {
        var usingUDP = controller.usingUDPLink()
        if (usingUDP) {
            console.log("onUsingUDPLink")
            showMessage("Sensor Calibration", "Performing sensor calibration over a WiFi connection is known to be unreliable. You should disconnect and perform calibration using a direct USB connection instead.", StandardButton.Ok)
        }
    }

Don Gagne's avatar
Don Gagne committed
216 217
    QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }

Don Gagne's avatar
Don Gagne committed
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
    Component {
        id: postCalibrationDialogComponent

        QGCViewDialog {
            QGCLabel {
                id:             textLabel
                anchors.left:   parent.left
                anchors.right:  parent.right
                wrapMode:       Text.WordWrap
                text:           _postCalibrationDialogText
            }

            QGCCheckBox {
                id:                 showValues
                anchors.topMargin:  ScreenTools.defaultFontPixelHeight
                anchors.top:        textLabel.bottom
234
                text:               qsTr("Show values")
Don Gagne's avatar
Don Gagne committed
235 236
            }

Don Gagne's avatar
Don Gagne committed
237
            QGCFlickable {
Don Gagne's avatar
Don Gagne committed
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
                anchors.topMargin:  ScreenTools.defaultFontPixelHeight
                anchors.top:        showValues.bottom
                anchors.bottom:     parent.bottom
                contentHeight:      valueColumn.height
                flickableDirection: Flickable.VerticalFlick
                visible:            showValues.checked

                Column {
                    id: valueColumn

                    Repeater {
                        model: _postCalibrationDialogParams

                        QGCLabel {
                            text: fact.name +": " + fact.valueString

                            property Fact fact: controller.getParameterFact(-1, modelData)
                        }
                    }
                }
            }
        }
    }

Don Gagne's avatar
Don Gagne committed
262
    Component {
Don Gagne's avatar
Don Gagne committed
263
        id: orientationsDialogComponent
Don Gagne's avatar
Don Gagne committed
264

Don Gagne's avatar
Don Gagne committed
265 266
        QGCViewDialog {
            id: orientationsDialog
Don Gagne's avatar
Don Gagne committed
267

Don Gagne's avatar
Don Gagne committed
268 269 270 271 272 273 274
            function accept() {
                if (_orientationDialogCalType == _calTypeAccel) {
                    controller.calibrateAccel()
                } else if (_orientationDialogCalType == _calTypeCompass) {
                    controller.calibrateCompass()
                }
                orientationsDialog.hideDialog()
275
            }
Don Gagne's avatar
Don Gagne committed
276

Don Gagne's avatar
Don Gagne committed
277 278 279 280
            QGCFlickable {
                anchors.fill:   parent
                contentHeight:  columnLayout.height
                clip:           true
Don Gagne's avatar
Don Gagne committed
281

Don Gagne's avatar
Don Gagne committed
282 283 284 285 286 287 288
                Column {
                    id:                 columnLayout
                    anchors.margins:    ScreenTools.defaultFontPixelWidth
                    anchors.left:       parent.left
                    anchors.right:      parent.right
                    anchors.top:        parent.top
                    spacing:            ScreenTools.defaultFontPixelHeight
Don Gagne's avatar
Don Gagne committed
289

Don Gagne's avatar
Don Gagne committed
290 291 292 293 294
                    QGCLabel {
                        width:      parent.width
                        wrapMode:   Text.WordWrap
                        text:       _orientationDialogHelp
                    }
Don Gagne's avatar
Don Gagne committed
295

Don Gagne's avatar
Don Gagne committed
296 297 298 299
                    Column {
                        QGCLabel {
                            text: qsTr("Autopilot Orientation:")
                        }
Don Gagne's avatar
Don Gagne committed
300

Don Gagne's avatar
Don Gagne committed
301 302 303 304 305 306
                        FactComboBox {
                            width:      rotationColumnWidth
                            indexModel: false
                            fact:       boardRot
                        }
                    }
Don Gagne's avatar
Don Gagne committed
307

Don Gagne's avatar
Don Gagne committed
308
                    Column {
309
                        visible: _orientationsDialogShowCompass && showCompass1
Don Gagne's avatar
Don Gagne committed
310

311 312 313 314 315 316 317
                        FactCheckBox {
                            text: "Use Compass 1"
                            fact: compass1UseFact
                        }

                        Column {
                            visible: showCompass1Rot
318

Don Gagne's avatar
Don Gagne committed
319 320 321
                            QGCLabel {
                                text: qsTr("Compass 1 Orientation:")
                            }
322

Don Gagne's avatar
Don Gagne committed
323 324 325 326 327 328 329
                            FactComboBox {
                                width:      rotationColumnWidth
                                indexModel: false
                                fact:       compass1Rot
                            }
                        }
                    }
330

Don Gagne's avatar
Don Gagne committed
331
                    Column {
332 333 334 335 336 337
                        visible: _orientationsDialogShowCompass && showCompass2

                        FactCheckBox {
                            text: "Use Compass 2"
                            fact: compass2UseFact
                        }
338

339 340
                        Column {
                            visible: showCompass1Rot
Don Gagne's avatar
Don Gagne committed
341 342 343 344 345 346 347 348 349 350 351 352 353 354

                            QGCLabel {
                                text: qsTr("Compass 2 Orientation:")
                            }

                            FactComboBox {
                                width:      rotationColumnWidth
                                indexModel: false
                                fact:       compass2Rot
                            }
                        }
                    }

                    Column {
355
                        visible: _orientationsDialogShowCompass && showCompass3
Don Gagne's avatar
Don Gagne committed
356

357 358 359 360 361 362 363
                        FactCheckBox {
                            text: "Use Compass 3"
                            fact: compass3UseFact
                        }

                        Column {
                            visible: showCompass3Rot
Don Gagne's avatar
Don Gagne committed
364 365

                            QGCLabel {
366
                                text: qsTr("Compass 3 Orientation:")
Don Gagne's avatar
Don Gagne committed
367 368 369 370 371 372 373 374 375 376 377 378 379
                            }

                            FactComboBox {
                                width:      rotationColumnWidth
                                indexModel: false
                                fact:       compass3Rot
                            }
                        }
                    }
                } // Column
            } // QGCFlickable
        } // QGCViewDialog
    } // Component - orientationsDialogComponent
Don Gagne's avatar
Don Gagne committed
380

381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446
    Component {
        id: compassMotDialogComponent

        QGCViewDialog {
            id: compassMotDialog

            function accept() {
                controller.calibrateMotorInterference()
                compassMotDialog.hideDialog()
            }

            QGCFlickable {
                anchors.fill:   parent
                contentHeight:  columnLayout.height
                clip:           true

                Column {
                    id:                 columnLayout
                    anchors.margins:    ScreenTools.defaultFontPixelWidth
                    anchors.left:       parent.left
                    anchors.right:      parent.right
                    anchors.top:        parent.top
                    spacing:            ScreenTools.defaultFontPixelHeight

                    QGCLabel {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        wrapMode:       Text.WordWrap
                        text:           "This is recommended for vehicles that have only an internal compass and on vehicles where there is significant interference on the compass from the motors, power wires, etc. " +
                                        "CompassMot only works well if you have a battery current monitor because the magnetic interference is linear with current drawn. " +
                                        "It is technically possible to set-up CompassMot using throttle but this is not recommended."
                    }

                    QGCLabel {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        wrapMode:       Text.WordWrap
                        text:           "Disconnect your props, flip them over and rotate them one position around the frame. " +
                                        "In this configuration they should push the copter down into the ground when the throttle is raised."
                    }

                    QGCLabel {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        wrapMode:       Text.WordWrap
                        text:           "Secure the copter (perhaps with tape) so that it does not move."
                    }

                    QGCLabel {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        wrapMode:       Text.WordWrap
                        text:           "Turn on your transmitter and keep throttle at zero."
                    }

                    QGCLabel {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        wrapMode:       Text.WordWrap
                        text:           "Click Ok to start CompassMot calibration."
                    }
                } // Column
            } // QGCFlickable
        } // QGCViewDialog
    }

Don Gagne's avatar
Don Gagne committed
447 448 449 450
    QGCViewPanel {
        id:             panel
        anchors.fill:   parent

Don Gagne's avatar
Don Gagne committed
451 452 453
        Column {
            id:         buttonColumn
            spacing:    ScreenTools.defaultFontPixelHeight / 2
Don Gagne's avatar
Don Gagne committed
454

455
            readonly property int buttonWidth: ScreenTools.defaultFontPixelWidth * 15
Don Gagne's avatar
Don Gagne committed
456

Don Gagne's avatar
Don Gagne committed
457 458 459
            IndicatorButton {
                id:             accelButton
                width:          parent.buttonWidth
460
                text:           qsTr("Accelerometer")
Don Gagne's avatar
Don Gagne committed
461 462
                indicatorGreen: !accelCalNeeded

Don Gagne's avatar
Don Gagne committed
463
                onClicked: showOrientationsDialog(_calTypeAccel)
Don Gagne's avatar
Don Gagne committed
464 465
            }

466 467 468
            IndicatorButton {
                id:             compassButton
                width:          parent.buttonWidth
469
                text:           qsTr("Compass")
470
                indicatorGreen: !compassCalNeeded
Don Gagne's avatar
Don Gagne committed
471

472 473
                onClicked: {
                    if (controller.accelSetupNeeded) {
474
                        showMessage(qsTr("Calibrate Compass"), qsTr("Accelerometer must be calibrated prior to Compass."), StandardButton.Ok)
475
                    } else {
Don Gagne's avatar
Don Gagne committed
476
                        showOrientationsDialog(_calTypeCompass)
Don Gagne's avatar
Don Gagne committed
477 478
                    }
                }
479
            }
Don Gagne's avatar
Don Gagne committed
480

481
            QGCButton {
482 483 484 485 486 487 488
                id:         motorInterferenceButton
                width:      parent.buttonWidth
                text:       qsTr("CompassMot")
                onClicked:  showDialog(compassMotDialogComponent, qsTr("CompassMot - Compass Motor Interference Calibration"), qgcView.showDialogFullWidth, StandardButton.Cancel | StandardButton.Ok)
            }

            QGCButton {
489
                id:         nextButton
Don Gagne's avatar
Don Gagne committed
490
                width:      parent.buttonWidth
491
                text:       qsTr("Next")
492 493
                enabled:    false
                onClicked:  controller.nextClicked()
Don Gagne's avatar
Don Gagne committed
494 495
            }

496 497
            QGCButton {
                id:         cancelButton
Don Gagne's avatar
Don Gagne committed
498
                width:      parent.buttonWidth
499
                text:       qsTr("Cancel")
500 501 502
                enabled:    false
                onClicked:  controller.cancelCalibration()
            }
Don Gagne's avatar
Don Gagne committed
503

Don Gagne's avatar
Don Gagne committed
504 505 506
            QGCButton {
                id:         setOrientationsButton
                width:      parent.buttonWidth
507
                text:       qsTr("Sensor Settings")
Don Gagne's avatar
Don Gagne committed
508 509 510
                onClicked:  showOrientationsDialog(_calTypeSet)
            }
        } // Column - Buttons
511

Don Gagne's avatar
Don Gagne committed
512 513 514 515 516 517 518 519 520 521 522
        Column {
            anchors.leftMargin: ScreenTools.defaultFontPixelWidth / 2
            anchors.left:       buttonColumn.right
            anchors.right:      parent.right
            anchors.top:        parent.top
            anchors.bottom:     parent.bottom

            ProgressBar {
                id:             progressBar
                anchors.left:   parent.left
                anchors.right:  parent.right
523
            }
Don Gagne's avatar
Don Gagne committed
524

Don Gagne's avatar
Don Gagne committed
525
            Item { height: ScreenTools.defaultFontPixelHeight; width: 10 } // spacer
Don Gagne's avatar
Don Gagne committed
526

Don Gagne's avatar
Don Gagne committed
527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542
            Item {
                id:     centerPanel
                width:  parent.width
                height: parent.height - y

                TextArea {
                    id:             statusTextArea
                    anchors.fill:   parent
                    readOnly:       true
                    frameVisible:   false
                    text:           statusTextAreaDefaultText

                    style: TextAreaStyle {
                        textColor:          qgcPal.text
                        backgroundColor:    qgcPal.windowShade
                    }
Don Gagne's avatar
Don Gagne committed
543 544
                }

Don Gagne's avatar
Don Gagne committed
545 546 547 548 549 550 551 552 553 554 555 556 557 558
                Rectangle {
                    id:             orientationCalArea
                    anchors.fill:   parent
                    visible:        controller.showOrientationCalArea
                    color:          qgcPal.windowShade

                    QGCLabel {
                        id:                 orientationCalAreaHelpText
                        anchors.margins:    ScreenTools.defaultFontPixelWidth
                        anchors.top:        orientationCalArea.top
                        anchors.left:       orientationCalArea.left
                        width:              parent.width
                        wrapMode:           Text.WordWrap
                        font.pointSize:     ScreenTools.mediumFontPointSize
Don Gagne's avatar
Don Gagne committed
559
                    }
Don Gagne's avatar
Don Gagne committed
560 561 562 563 564 565 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 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625

                    Flow {
                        anchors.topMargin:  ScreenTools.defaultFontPixelWidth
                        anchors.top:        orientationCalAreaHelpText.bottom
                        anchors.bottom:     parent.bottom
                        anchors.left:       parent.left
                        anchors.right:      parent.right
                        spacing:            ScreenTools.defaultFontPixelWidth

                        property real indicatorWidth:   (width / 3) - (spacing * 2)
                        property real indicatorHeight:  (height / 2) - spacing

                        VehicleRotationCal {
                            width:              parent.indicatorWidth
                            height:             parent.indicatorHeight
                            visible:            controller.orientationCalDownSideVisible
                            calValid:           controller.orientationCalDownSideDone
                            calInProgress:      controller.orientationCalDownSideInProgress
                            calInProgressText:  controller.orientationCalDownSideRotate ? qsTr("Rotate") : qsTr("Hold Still")
                            imageSource:        controller.orientationCalDownSideRotate ? "qrc:///qmlimages/VehicleDownRotate.png" : "qrc:///qmlimages/VehicleDown.png"
                        }
                        VehicleRotationCal {
                            width:              parent.indicatorWidth
                            height:             parent.indicatorHeight
                            visible:            controller.orientationCalUpsideDownSideVisible
                            calValid:           controller.orientationCalUpsideDownSideDone
                            calInProgress:      controller.orientationCalUpsideDownSideInProgress
                            calInProgressText:  controller.orientationCalUpsideDownSideRotate ? qsTr("Rotate") : qsTr("Hold Still")
                            imageSource:        controller.orientationCalUpsideDownSideRotate ? "qrc:///qmlimages/VehicleUpsideDownRotate.png" : "qrc:///qmlimages/VehicleUpsideDown.png"
                        }
                        VehicleRotationCal {
                            width:              parent.indicatorWidth
                            height:             parent.indicatorHeight
                            visible:            controller.orientationCalNoseDownSideVisible
                            calValid:           controller.orientationCalNoseDownSideDone
                            calInProgress:      controller.orientationCalNoseDownSideInProgress
                            calInProgressText:  controller.orientationCalNoseDownSideRotate ? qsTr("Rotate") : qsTr("Hold Still")
                            imageSource:        controller.orientationCalNoseDownSideRotate ? "qrc:///qmlimages/VehicleNoseDownRotate.png" : "qrc:///qmlimages/VehicleNoseDown.png"
                        }
                        VehicleRotationCal {
                            width:              parent.indicatorWidth
                            height:             parent.indicatorHeight
                            visible:            controller.orientationCalTailDownSideVisible
                            calValid:           controller.orientationCalTailDownSideDone
                            calInProgress:      controller.orientationCalTailDownSideInProgress
                            calInProgressText:  controller.orientationCalTailDownSideRotate ? qsTr("Rotate") : qsTr("Hold Still")
                            imageSource:        controller.orientationCalTailDownSideRotate ? "qrc:///qmlimages/VehicleTailDownRotate.png" : "qrc:///qmlimages/VehicleTailDown.png"
                        }
                        VehicleRotationCal {
                            width:              parent.indicatorWidth
                            height:             parent.indicatorHeight
                            visible:            controller.orientationCalLeftSideVisible
                            calValid:           controller.orientationCalLeftSideDone
                            calInProgress:      controller.orientationCalLeftSideInProgress
                            calInProgressText:  controller.orientationCalLeftSideRotate ? qsTr("Rotate") : qsTr("Hold Still")
                            imageSource:        controller.orientationCalLeftSideRotate ? "qrc:///qmlimages/VehicleLeftRotate.png" : "qrc:///qmlimages/VehicleLeft.png"
                        }
                        VehicleRotationCal {
                            width:              parent.indicatorWidth
                            height:             parent.indicatorHeight
                            visible:            controller.orientationCalRightSideVisible
                            calValid:           controller.orientationCalRightSideDone
                            calInProgress:      controller.orientationCalRightSideInProgress
                            calInProgressText:  controller.orientationCalRightSideRotate ? qsTr("Rotate") : qsTr("Hold Still")
                            imageSource:        controller.orientationCalRightSideRotate ? "qrc:///qmlimages/VehicleRightRotate.png" : "qrc:///qmlimages/VehicleRight.png"
                        }
Don Gagne's avatar
Don Gagne committed
626 627
                    }
                }
Don Gagne's avatar
Don Gagne committed
628 629
            } // Item - Cal display area
        } // Column - cal display
Don Gagne's avatar
Don Gagne committed
630 631
    } // QGCViewPanel
} // QGCView