TelemetryRSSIIndicator.qml 4.33 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
/****************************************************************************
 *
 *   (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.
 *
 ****************************************************************************/


11 12 13
import QtQuick          2.3
import QtQuick.Controls 1.2
import QtQuick.Layouts  1.2
14 15 16 17 18 19 20 21 22

import QGroundControl                       1.0
import QGroundControl.Controls              1.0
import QGroundControl.MultiVehicleManager   1.0
import QGroundControl.ScreenTools           1.0
import QGroundControl.Palette               1.0

//-------------------------------------------------------------------------
//-- Telemetry RSSI
23 24 25 26 27
Item {
    anchors.top:    parent.top
    anchors.bottom: parent.bottom
    width:          _hasTelemetry ? telemIcon.width * 1.1 : 0
    visible:        _hasTelemetry
28

29 30 31 32 33 34
    //-- SiK Radio: -120 to < 0
    //-- Others:    > 0 - 100

    property var  _activeVehicle:   QGroundControl.multiVehicleManager.activeVehicle
    property bool _isSiKRadio:      _activeVehicle ? _activeVehicle.telemetryLRSSI < 0 : false
    property bool _hasTelemetry:    _activeVehicle ? _activeVehicle.telemetryLRSSI !== 0 : false
35

36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
    Component {
        id: telemRSSIInfo
        Rectangle {
            width:  telemCol.width   + ScreenTools.defaultFontPixelWidth  * 3
            height: telemCol.height  + ScreenTools.defaultFontPixelHeight * 2
            radius: ScreenTools.defaultFontPixelHeight * 0.5
            color:  qgcPal.window
            border.color:   qgcPal.text
            Column {
                id:                 telemCol
                spacing:            ScreenTools.defaultFontPixelHeight * 0.5
                width:              Math.max(telemGrid.width, telemLabel.width)
                anchors.margins:    ScreenTools.defaultFontPixelHeight
                anchors.centerIn:   parent
                QGCLabel {
                    id:             telemLabel
                    text:           qsTr("Telemetry RSSI Status")
                    font.family:    ScreenTools.demiboldFontFamily
                    anchors.horizontalCenter: parent.horizontalCenter
                }
                GridLayout {
                    id:                 telemGrid
                    anchors.margins:    ScreenTools.defaultFontPixelHeight
                    columnSpacing:      ScreenTools.defaultFontPixelWidth
                    columns:            2
                    anchors.horizontalCenter: parent.horizontalCenter
                    QGCLabel { text: qsTr("Local RSSI:") }
63
                    QGCLabel { text: _activeVehicle.telemetryLRSSI + _isSiKRadio ? " dBm" : ""}
64
                    QGCLabel { text: qsTr("Remote RSSI:") }
65
                    QGCLabel { text: _activeVehicle.telemetryRRSSI + _isSiKRadio ? " dBm" : ""}
66
                    QGCLabel { text: qsTr("RX Errors:") }
67
                    QGCLabel { text: _activeVehicle.telemetryRXErrors }
68
                    QGCLabel { text: qsTr("Errors Fixed:") }
69
                    QGCLabel { text: _activeVehicle.telemetryFixed }
70
                    QGCLabel { text: qsTr("TX Buffer:") }
71
                    QGCLabel { text: _activeVehicle.telemetryTXBuffer }
72
                    QGCLabel { text: qsTr("Local Noise:") }
73
                    QGCLabel { text: _activeVehicle.telemetryLNoise }
74
                    QGCLabel { text: qsTr("Remote Noise:") }
75
                    QGCLabel { text: _activeVehicle.telemetryRNoise }
76 77 78 79 80 81 82 83 84
                }
            }
            Component.onCompleted: {
                var pos = mapFromItem(toolBar, centerX - (width / 2), toolBar.height)
                x = pos.x
                y = pos.y + ScreenTools.defaultFontPixelHeight
            }
        }
    }
85 86 87 88 89 90 91 92 93 94
    QGCColoredImage {
        id:                 telemIcon
        anchors.top:        parent.top
        anchors.bottom:     parent.bottom
        width:              height
        sourceSize.height:  height
        source:             "/qmlimages/TelemRSSI.svg"
        fillMode:           Image.PreserveAspectFit
        color:              qgcPal.buttonText
    }
95 96 97 98 99 100 101 102
    MouseArea {
        anchors.fill: parent
        onClicked: {
            var centerX = mapToItem(toolBar, x, y).x + (width / 2)
            mainWindow.showPopUp(telemRSSIInfo, centerX)
        }
    }
}