1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-30 15:52:12 +01:00

LP-574 Check if adc inputs are configured before displaying battery data on PFD

This commit is contained in:
Laurent Lalanne 2018-01-27 12:19:29 +01:00
parent 4c9c3c202c
commit bdf66cafd7
2 changed files with 28 additions and 6 deletions

View File

@ -318,6 +318,28 @@ function batteryModuleEnabled() {
return (hwSettings.optionalModulesBattery == HwSettings.OptionalModules.Enabled);
}
function batteryModuleADCConfigured() {
if ((hwSettings.adcRoutingadc0 == HwSettings.ADCRouting.BatteryVoltage) ||
(hwSettings.adcRoutingadc0 == HwSettings.ADCRouting.BatteryCurrent) ||
(hwSettings.adcRoutingadc1 == HwSettings.ADCRouting.BatteryVoltage) ||
(hwSettings.adcRoutingadc1 == HwSettings.ADCRouting.BatteryCurrent) ||
(hwSettings.adcRoutingadc2 == HwSettings.ADCRouting.BatteryVoltage) ||
(hwSettings.adcRoutingadc2 == HwSettings.ADCRouting.BatteryCurrent) ||
(hwSettings.adcRoutingadc3 == HwSettings.ADCRouting.BatteryVoltage) ||
(hwSettings.adcRoutingadc3 == HwSettings.ADCRouting.BatteryCurrent) ||
(hwSettings.adcRoutingadc4 == HwSettings.ADCRouting.BatteryVoltage) ||
(hwSettings.adcRoutingadc4 == HwSettings.ADCRouting.BatteryCurrent) ||
(hwSettings.adcRoutingadc5 == HwSettings.ADCRouting.BatteryVoltage) ||
(hwSettings.adcRoutingadc5 == HwSettings.ADCRouting.BatteryCurrent) ||
(hwSettings.adcRoutingadc6 == HwSettings.ADCRouting.BatteryVoltage) ||
(hwSettings.adcRoutingadc6 == HwSettings.ADCRouting.BatteryCurrent) ||
(hwSettings.adcRoutingadc7 == HwSettings.ADCRouting.BatteryVoltage) ||
(hwSettings.adcRoutingadc7 == HwSettings.ADCRouting.BatteryCurrent)) {
return true;
}
return false;
}
function batteryNbCells() {
return flightBatterySettings.nbCells;
}

View File

@ -271,7 +271,7 @@ Item {
}
// 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 {
id: topbattery_voltamp_bg
@ -281,7 +281,7 @@ Item {
width: scaledBounds.width * sceneItem.width
height: scaledBounds.height * sceneItem.height
y: scaledBounds.y * sceneItem.height
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled())
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled() && UAV.batteryModuleADCConfigured())
Rectangle {
anchors.fill: parent
@ -296,7 +296,7 @@ Item {
width: scaledBounds.width * sceneItem.width
height: scaledBounds.height * sceneItem.height
y: Math.floor(scaledBounds.y * sceneItem.height)
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled())
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled() && UAV.batteryModuleADCConfigured())
}
SvgElementPositionItem {
@ -307,7 +307,7 @@ Item {
width: scaledBounds.width * sceneItem.width
height: scaledBounds.height * sceneItem.height
y: scaledBounds.y * sceneItem.height
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled())
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled() && UAV.batteryModuleADCConfigured())
Rectangle {
anchors.fill: parent
@ -334,7 +334,7 @@ Item {
width: scaledBounds.width * sceneItem.width
height: scaledBounds.height * sceneItem.height
y: scaledBounds.y * sceneItem.height
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled())
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled() && UAV.batteryModuleADCConfigured())
Rectangle {
anchors.fill: parent
@ -361,7 +361,7 @@ Item {
width: scaledBounds.width * sceneItem.width
height: scaledBounds.height * sceneItem.height
y: scaledBounds.y * sceneItem.height
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled())
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled() && UAV.batteryModuleADCConfigured())
Rectangle {
anchors.fill: parent