Commit 5fff9645 authored by Donald Gagne's avatar Donald Gagne

Fix reference to non-existent property

parent 3036d59f
...@@ -25,15 +25,17 @@ Item { ...@@ -25,15 +25,17 @@ Item {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
width: batteryIndicatorRow.width width: batteryIndicatorRow.width
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
function getBatteryColor() { function getBatteryColor() {
if(activeVehicle) { if(_activeVehicle) {
if(activeVehicle.battery.percentRemaining.value > 75) { if(_activeVehicle.battery.percentRemaining.value > 75) {
return qgcPal.text return qgcPal.text
} }
if(activeVehicle.battery.percentRemaining.value > 50) { if(_activeVehicle.battery.percentRemaining.value > 50) {
return colorOrange return colorOrange
} }
if(activeVehicle.battery.percentRemaining.value > 0.1) { if(_activeVehicle.battery.percentRemaining.value > 0.1) {
return colorRed return colorRed
} }
} }
...@@ -41,15 +43,15 @@ Item { ...@@ -41,15 +43,15 @@ Item {
} }
function getBatteryPercentageText() { function getBatteryPercentageText() {
if(activeVehicle) { if(_activeVehicle) {
if(activeVehicle.battery.percentRemaining.value > 98.9) { if(_activeVehicle.battery.percentRemaining.value > 98.9) {
return "100%" return "100%"
} }
if(activeVehicle.battery.percentRemaining.value > 0.1) { if(_activeVehicle.battery.percentRemaining.value > 0.1) {
return activeVehicle.battery.percentRemaining.valueString + activeVehicle.battery.percentRemaining.units return _activeVehicle.battery.percentRemaining.valueString + _activeVehicle.battery.percentRemaining.units
} }
if(activeVehicle.battery.voltage.value >= 0) { if(_activeVehicle.battery.voltage.value >= 0) {
return activeVehicle.battery.voltage.valueString + activeVehicle.battery.voltage.units return _activeVehicle.battery.voltage.valueString + _activeVehicle.battery.voltage.units
} }
} }
return "N/A" return "N/A"
...@@ -87,9 +89,9 @@ Item { ...@@ -87,9 +89,9 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
QGCLabel { text: qsTr("Voltage:") } QGCLabel { text: qsTr("Voltage:") }
QGCLabel { text: (activeVehicle && activeVehicle.battery.voltage.value != -1) ? (activeVehicle.battery.voltage.valueString + " " + activeVehicle.battery.voltage.units) : "N/A" } QGCLabel { text: (_activeVehicle && _activeVehicle.battery.voltage.value != -1) ? (_activeVehicle.battery.voltage.valueString + " " + _activeVehicle.battery.voltage.units) : "N/A" }
QGCLabel { text: qsTr("Accumulated Consumption:") } QGCLabel { text: qsTr("Accumulated Consumption:") }
QGCLabel { text: (activeVehicle && activeVehicle.battery.mahConsumed.value != -1) ? (activeVehicle.battery.mahConsumed.valueString + " " + activeVehicle.battery.mahConsumed.units) : "N/A" } QGCLabel { text: (_activeVehicle && _activeVehicle.battery.mahConsumed.value != -1) ? (_activeVehicle.battery.mahConsumed.valueString + " " + _activeVehicle.battery.mahConsumed.units) : "N/A" }
} }
} }
...@@ -105,7 +107,7 @@ Item { ...@@ -105,7 +107,7 @@ Item {
id: batteryIndicatorRow id: batteryIndicatorRow
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
opacity: (activeVehicle && activeVehicle.battery.voltage.value >= 0) ? 1 : 0.5 opacity: (_activeVehicle && _activeVehicle.battery.voltage.value >= 0) ? 1 : 0.5
QGCColoredImage { QGCColoredImage {
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
......
...@@ -25,15 +25,17 @@ Item { ...@@ -25,15 +25,17 @@ Item {
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
function getMessageColor() { function getMessageColor() {
if (activeVehicle) { if (_activeVehicle) {
if (activeVehicle.messageTypeNone) if (_activeVehicle.messageTypeNone)
return colorGrey return colorGrey
if (activeVehicle.messageTypeNormal) if (_activeVehicle.messageTypeNormal)
return colorBlue; return colorBlue;
if (activeVehicle.messageTypeWarning) if (_activeVehicle.messageTypeWarning)
return colorOrange; return colorOrange;
if (activeVehicle.messageTypeError) if (_activeVehicle.messageTypeError)
return colorRed; return colorRed;
// Cannot be so make make it obnoxious to show error // Cannot be so make make it obnoxious to show error
console.log("Invalid vehicle message type") console.log("Invalid vehicle message type")
...@@ -50,7 +52,7 @@ Item { ...@@ -50,7 +52,7 @@ Item {
sourceSize.height: height sourceSize.height: height
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
cache: false cache: false
visible: activeVehicle && activeVehicle.messageCount > 0 && isMessageImportant visible: _activeVehicle && _activeVehicle.messageCount > 0 && isMessageImportant
} }
QGCColoredImage { QGCColoredImage {
......
...@@ -23,9 +23,12 @@ Item { ...@@ -23,9 +23,12 @@ Item {
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
width: flightModeSelector.width width: flightModeSelector.width
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
QGCLabel { QGCLabel {
id: flightModeSelector id: flightModeSelector
text: activeVehicle ? activeVehicle.flightMode : qsTr("N/A", "No data to display") text: _activeVehicle ? _activeVehicle.flightMode : qsTr("N/A", "No data to display")
font.pointSize: ScreenTools.mediumFontPointSize font.pointSize: ScreenTools.mediumFontPointSize
color: qgcPal.buttonText color: qgcPal.buttonText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
...@@ -35,20 +38,20 @@ Item { ...@@ -35,20 +38,20 @@ Item {
Component { Component {
id: flightModeMenuItemComponent id: flightModeMenuItemComponent
MenuItem { MenuItem {
onTriggered: activeVehicle.flightMode = text onTriggered: _activeVehicle.flightMode = text
} }
} }
property var flightModesMenuItems: [] property var flightModesMenuItems: []
function updateFlightModesMenu() { function updateFlightModesMenu() {
if (activeVehicle && activeVehicle.flightModeSetAvailable) { if (_activeVehicle && _activeVehicle.flightModeSetAvailable) {
// Remove old menu items // Remove old menu items
for (var i = 0; i < flightModesMenuItems.length; i++) { for (var i = 0; i < flightModesMenuItems.length; i++) {
flightModesMenu.removeItem(flightModesMenuItems[i]) flightModesMenu.removeItem(flightModesMenuItems[i])
} }
flightModesMenuItems.length = 0 flightModesMenuItems.length = 0
// Add new items // Add new items
for (var i = 0; i < activeVehicle.flightModes.length; i++) { for (var i = 0; i < _activeVehicle.flightModes.length; i++) {
var menuItem = flightModeMenuItemComponent.createObject(null, { "text": activeVehicle.flightModes[i] }) var menuItem = flightModeMenuItemComponent.createObject(null, { "text": _activeVehicle.flightModes[i] })
flightModesMenuItems.push(menuItem) flightModesMenuItems.push(menuItem)
flightModesMenu.insertItem(i, menuItem) flightModesMenu.insertItem(i, menuItem)
} }
...@@ -60,7 +63,7 @@ Item { ...@@ -60,7 +63,7 @@ Item {
onActiveVehicleChanged: flightModeSelector.updateFlightModesMenu() onActiveVehicleChanged: flightModeSelector.updateFlightModesMenu()
} }
MouseArea { MouseArea {
visible: activeVehicle && activeVehicle.flightModeSetAvailable visible: _activeVehicle && _activeVehicle.flightModeSetAvailable
anchors.fill: parent anchors.fill: parent
onClicked: flightModesMenu.popup() onClicked: flightModesMenu.popup()
} }
......
...@@ -24,7 +24,9 @@ Item { ...@@ -24,7 +24,9 @@ Item {
width: rssiRow.width * 1.1 width: rssiRow.width * 1.1
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
visible: activeVehicle ? activeVehicle.supportsRadio : true visible: _activeVehicle ? _activeVehicle.supportsRadio : true
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
Component { Component {
id: rcRSSIInfo id: rcRSSIInfo
...@@ -45,21 +47,21 @@ Item { ...@@ -45,21 +47,21 @@ Item {
QGCLabel { QGCLabel {
id: rssiLabel id: rssiLabel
text: activeVehicle ? (activeVehicle.rcRSSI != 255 ? qsTr("RC RSSI Status") : qsTr("RC RSSI Data Unavailable")) : qsTr("N/A", "No data available") text: _activeVehicle ? (_activeVehicle.rcRSSI != 255 ? qsTr("RC RSSI Status") : qsTr("RC RSSI Data Unavailable")) : qsTr("N/A", "No data available")
font.family: ScreenTools.demiboldFontFamily font.family: ScreenTools.demiboldFontFamily
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
GridLayout { GridLayout {
id: rcrssiGrid id: rcrssiGrid
visible: activeVehicle && activeVehicle.rcRSSI != 255 visible: _activeVehicle && _activeVehicle.rcRSSI != 255
anchors.margins: ScreenTools.defaultFontPixelHeight anchors.margins: ScreenTools.defaultFontPixelHeight
columnSpacing: ScreenTools.defaultFontPixelWidth columnSpacing: ScreenTools.defaultFontPixelWidth
columns: 2 columns: 2
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
QGCLabel { text: qsTr("RSSI:") } QGCLabel { text: qsTr("RSSI:") }
QGCLabel { text: activeVehicle ? (activeVehicle.rcRSSI + "%") : 0 } QGCLabel { text: _activeVehicle ? (_activeVehicle.rcRSSI + "%") : 0 }
} }
} }
...@@ -84,14 +86,14 @@ Item { ...@@ -84,14 +86,14 @@ Item {
sourceSize.height: height sourceSize.height: height
source: "/qmlimages/RC.svg" source: "/qmlimages/RC.svg"
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
opacity: activeVehicle ? (((activeVehicle.rcRSSI < 0) || (activeVehicle.rcRSSI > 100)) ? 0.5 : 1) : 0.5 opacity: _activeVehicle ? (((_activeVehicle.rcRSSI < 0) || (_activeVehicle.rcRSSI > 100)) ? 0.5 : 1) : 0.5
color: qgcPal.buttonText color: qgcPal.buttonText
} }
SignalStrength { SignalStrength {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
size: parent.height * 0.5 size: parent.height * 0.5
percent: activeVehicle ? ((activeVehicle.rcRSSI > 100) ? 0 : activeVehicle.rcRSSI) : 0 percent: _activeVehicle ? ((_activeVehicle.rcRSSI > 100) ? 0 : _activeVehicle.rcRSSI) : 0
} }
} }
......
...@@ -27,7 +27,10 @@ QGCColoredImage { ...@@ -27,7 +27,10 @@ QGCColoredImage {
source: "/qmlimages/TelemRSSI.svg" source: "/qmlimages/TelemRSSI.svg"
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
color: qgcPal.buttonText color: qgcPal.buttonText
visible: activeVehicle ? (activeVehicle.telemetryLRSSI < 0) : false visible: _activeVehicle ? (_activeVehicle.telemetryLRSSI < 0) : false
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
Component { Component {
id: telemRSSIInfo id: telemRSSIInfo
Rectangle { Rectangle {
...@@ -55,19 +58,19 @@ QGCColoredImage { ...@@ -55,19 +58,19 @@ QGCColoredImage {
columns: 2 columns: 2
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
QGCLabel { text: qsTr("Local RSSI:") } QGCLabel { text: qsTr("Local RSSI:") }
QGCLabel { text: activeVehicle.telemetryLRSSI + " dBm" } QGCLabel { text: _activeVehicle.telemetryLRSSI + " dBm" }
QGCLabel { text: qsTr("Remote RSSI:") } QGCLabel { text: qsTr("Remote RSSI:") }
QGCLabel { text: activeVehicle.telemetryRRSSI + " dBm" } QGCLabel { text: _activeVehicle.telemetryRRSSI + " dBm" }
QGCLabel { text: qsTr("RX Errors:") } QGCLabel { text: qsTr("RX Errors:") }
QGCLabel { text: activeVehicle.telemetryRXErrors } QGCLabel { text: _activeVehicle.telemetryRXErrors }
QGCLabel { text: qsTr("Errors Fixed:") } QGCLabel { text: qsTr("Errors Fixed:") }
QGCLabel { text: activeVehicle.telemetryFixed } QGCLabel { text: _activeVehicle.telemetryFixed }
QGCLabel { text: qsTr("TX Buffer:") } QGCLabel { text: qsTr("TX Buffer:") }
QGCLabel { text: activeVehicle.telemetryTXBuffer } QGCLabel { text: _activeVehicle.telemetryTXBuffer }
QGCLabel { text: qsTr("Local Noise:") } QGCLabel { text: qsTr("Local Noise:") }
QGCLabel { text: activeVehicle.telemetryLNoise } QGCLabel { text: _activeVehicle.telemetryLNoise }
QGCLabel { text: qsTr("Remote Noise:") } QGCLabel { text: qsTr("Remote Noise:") }
QGCLabel { text: activeVehicle.telemetryRNoise } QGCLabel { text: _activeVehicle.telemetryRNoise }
} }
} }
Component.onCompleted: { Component.onCompleted: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment