mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-21 11:54:15 +01:00
Merged in f5soh/librepilot/LP-574_PFD_Battery_display (pull request #489)
LP-574 Check if adc inputs are configured before displaying battery data on PFD Approved-by: Lalanne Laurent <f5soh@free.fr> Approved-by: Philippe Renon <philippe_renon@yahoo.fr>
This commit is contained in:
commit
4554500b35
@ -318,6 +318,18 @@ function batteryModuleEnabled() {
|
|||||||
return (hwSettings.optionalModulesBattery == HwSettings.OptionalModules.Enabled);
|
return (hwSettings.optionalModulesBattery == HwSettings.OptionalModules.Enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function batteryADCConfigured() {
|
||||||
|
for (var i = 0; i < 8; i++) {
|
||||||
|
var adcRouting = hwSettings.getADCRouting(i);
|
||||||
|
if (adcRouting == HwSettings.ADCRouting.BatteryVoltage) {
|
||||||
|
return true;
|
||||||
|
} else if (adcRouting == HwSettings.ADCRouting.BatteryCurrent) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function batteryNbCells() {
|
function batteryNbCells() {
|
||||||
return flightBatterySettings.nbCells;
|
return flightBatterySettings.nbCells;
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Battery Info (Top)
|
// Battery Info (Top)
|
||||||
// Only visible when PathPlan not active and Battery module enabled
|
// Only visible when PathPlan not active and Battery module enabled and ADC input configured
|
||||||
|
|
||||||
SvgElementPositionItem {
|
SvgElementPositionItem {
|
||||||
id: topbattery_voltamp_bg
|
id: topbattery_voltamp_bg
|
||||||
@ -281,7 +281,7 @@ Item {
|
|||||||
width: scaledBounds.width * sceneItem.width
|
width: scaledBounds.width * sceneItem.width
|
||||||
height: scaledBounds.height * sceneItem.height
|
height: scaledBounds.height * sceneItem.height
|
||||||
y: scaledBounds.y * sceneItem.height
|
y: scaledBounds.y * sceneItem.height
|
||||||
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled())
|
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled() && UAV.batteryADCConfigured())
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@ -296,7 +296,7 @@ Item {
|
|||||||
width: scaledBounds.width * sceneItem.width
|
width: scaledBounds.width * sceneItem.width
|
||||||
height: scaledBounds.height * sceneItem.height
|
height: scaledBounds.height * sceneItem.height
|
||||||
y: Math.floor(scaledBounds.y * sceneItem.height)
|
y: Math.floor(scaledBounds.y * sceneItem.height)
|
||||||
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled())
|
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled() && UAV.batteryADCConfigured())
|
||||||
}
|
}
|
||||||
|
|
||||||
SvgElementPositionItem {
|
SvgElementPositionItem {
|
||||||
@ -307,7 +307,7 @@ Item {
|
|||||||
width: scaledBounds.width * sceneItem.width
|
width: scaledBounds.width * sceneItem.width
|
||||||
height: scaledBounds.height * sceneItem.height
|
height: scaledBounds.height * sceneItem.height
|
||||||
y: scaledBounds.y * sceneItem.height
|
y: scaledBounds.y * sceneItem.height
|
||||||
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled())
|
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled() && UAV.batteryADCConfigured())
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@ -334,7 +334,7 @@ Item {
|
|||||||
width: scaledBounds.width * sceneItem.width
|
width: scaledBounds.width * sceneItem.width
|
||||||
height: scaledBounds.height * sceneItem.height
|
height: scaledBounds.height * sceneItem.height
|
||||||
y: scaledBounds.y * sceneItem.height
|
y: scaledBounds.y * sceneItem.height
|
||||||
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled())
|
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled() && UAV.batteryADCConfigured())
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@ -361,7 +361,7 @@ Item {
|
|||||||
width: scaledBounds.width * sceneItem.width
|
width: scaledBounds.width * sceneItem.width
|
||||||
height: scaledBounds.height * sceneItem.height
|
height: scaledBounds.height * sceneItem.height
|
||||||
y: scaledBounds.y * sceneItem.height
|
y: scaledBounds.y * sceneItem.height
|
||||||
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled())
|
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled() && UAV.batteryADCConfigured())
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
Loading…
x
Reference in New Issue
Block a user