|
|
|
@ -25,15 +25,17 @@ Item {
@@ -25,15 +25,17 @@ Item {
|
|
|
|
|
anchors.bottom: parent.bottom |
|
|
|
|
width: batteryIndicatorRow.width |
|
|
|
|
|
|
|
|
|
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle |
|
|
|
|
|
|
|
|
|
function getBatteryColor() { |
|
|
|
|
if(activeVehicle) { |
|
|
|
|
if(activeVehicle.battery.percentRemaining.value > 75) { |
|
|
|
|
if(_activeVehicle) { |
|
|
|
|
if(_activeVehicle.battery.percentRemaining.value > 75) { |
|
|
|
|
return qgcPal.text |
|
|
|
|
} |
|
|
|
|
if(activeVehicle.battery.percentRemaining.value > 50) { |
|
|
|
|
if(_activeVehicle.battery.percentRemaining.value > 50) { |
|
|
|
|
return colorOrange |
|
|
|
|
} |
|
|
|
|
if(activeVehicle.battery.percentRemaining.value > 0.1) { |
|
|
|
|
if(_activeVehicle.battery.percentRemaining.value > 0.1) { |
|
|
|
|
return colorRed |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -41,15 +43,15 @@ Item {
@@ -41,15 +43,15 @@ Item {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function getBatteryPercentageText() { |
|
|
|
|
if(activeVehicle) { |
|
|
|
|
if(activeVehicle.battery.percentRemaining.value > 98.9) { |
|
|
|
|
if(_activeVehicle) { |
|
|
|
|
if(_activeVehicle.battery.percentRemaining.value > 98.9) { |
|
|
|
|
return "100%" |
|
|
|
|
} |
|
|
|
|
if(activeVehicle.battery.percentRemaining.value > 0.1) { |
|
|
|
|
return activeVehicle.battery.percentRemaining.valueString + activeVehicle.battery.percentRemaining.units |
|
|
|
|
if(_activeVehicle.battery.percentRemaining.value > 0.1) { |
|
|
|
|
return _activeVehicle.battery.percentRemaining.valueString + _activeVehicle.battery.percentRemaining.units |
|
|
|
|
} |
|
|
|
|
if(activeVehicle.battery.voltage.value >= 0) { |
|
|
|
|
return activeVehicle.battery.voltage.valueString + activeVehicle.battery.voltage.units |
|
|
|
|
if(_activeVehicle.battery.voltage.value >= 0) { |
|
|
|
|
return _activeVehicle.battery.voltage.valueString + _activeVehicle.battery.voltage.units |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return "N/A" |
|
|
|
@ -87,9 +89,9 @@ Item {
@@ -87,9 +89,9 @@ Item {
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter |
|
|
|
|
|
|
|
|
|
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: (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 |
|
|
|
|
anchors.top: parent.top |
|
|
|
|
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 { |
|
|
|
|
anchors.top: parent.top |
|
|
|
|
anchors.bottom: parent.bottom |
|
|
|
|