Skip to content

Commit bdf66ca

Browse files
committed
LP-574 Check if adc inputs are configured before displaying battery data on PFD
1 parent 4c9c3c2 commit bdf66ca

2 files changed

Lines changed: 28 additions & 6 deletions

File tree

ground/gcs/src/share/qml/js/uav.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,28 @@ function batteryModuleEnabled() {
318318
return (hwSettings.optionalModulesBattery == HwSettings.OptionalModules.Enabled);
319319
}
320320

321+
function batteryModuleADCConfigured() {
322+
if ((hwSettings.adcRoutingadc0 == HwSettings.ADCRouting.BatteryVoltage) ||
323+
(hwSettings.adcRoutingadc0 == HwSettings.ADCRouting.BatteryCurrent) ||
324+
(hwSettings.adcRoutingadc1 == HwSettings.ADCRouting.BatteryVoltage) ||
325+
(hwSettings.adcRoutingadc1 == HwSettings.ADCRouting.BatteryCurrent) ||
326+
(hwSettings.adcRoutingadc2 == HwSettings.ADCRouting.BatteryVoltage) ||
327+
(hwSettings.adcRoutingadc2 == HwSettings.ADCRouting.BatteryCurrent) ||
328+
(hwSettings.adcRoutingadc3 == HwSettings.ADCRouting.BatteryVoltage) ||
329+
(hwSettings.adcRoutingadc3 == HwSettings.ADCRouting.BatteryCurrent) ||
330+
(hwSettings.adcRoutingadc4 == HwSettings.ADCRouting.BatteryVoltage) ||
331+
(hwSettings.adcRoutingadc4 == HwSettings.ADCRouting.BatteryCurrent) ||
332+
(hwSettings.adcRoutingadc5 == HwSettings.ADCRouting.BatteryVoltage) ||
333+
(hwSettings.adcRoutingadc5 == HwSettings.ADCRouting.BatteryCurrent) ||
334+
(hwSettings.adcRoutingadc6 == HwSettings.ADCRouting.BatteryVoltage) ||
335+
(hwSettings.adcRoutingadc6 == HwSettings.ADCRouting.BatteryCurrent) ||
336+
(hwSettings.adcRoutingadc7 == HwSettings.ADCRouting.BatteryVoltage) ||
337+
(hwSettings.adcRoutingadc7 == HwSettings.ADCRouting.BatteryCurrent)) {
338+
return true;
339+
}
340+
return false;
341+
}
342+
321343
function batteryNbCells() {
322344
return flightBatterySettings.nbCells;
323345
}

ground/gcs/src/share/qml/pfd/Info.qml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ Item {
271271
}
272272

273273
// Battery Info (Top)
274-
// Only visible when PathPlan not active and Battery module enabled
274+
// Only visible when PathPlan not active and Battery module enabled and ADC input configured
275275

276276
SvgElementPositionItem {
277277
id: topbattery_voltamp_bg
@@ -281,7 +281,7 @@ Item {
281281
width: scaledBounds.width * sceneItem.width
282282
height: scaledBounds.height * sceneItem.height
283283
y: scaledBounds.y * sceneItem.height
284-
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled())
284+
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled() && UAV.batteryModuleADCConfigured())
285285

286286
Rectangle {
287287
anchors.fill: parent
@@ -296,7 +296,7 @@ Item {
296296
width: scaledBounds.width * sceneItem.width
297297
height: scaledBounds.height * sceneItem.height
298298
y: Math.floor(scaledBounds.y * sceneItem.height)
299-
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled())
299+
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled() && UAV.batteryModuleADCConfigured())
300300
}
301301

302302
SvgElementPositionItem {
@@ -307,7 +307,7 @@ Item {
307307
width: scaledBounds.width * sceneItem.width
308308
height: scaledBounds.height * sceneItem.height
309309
y: scaledBounds.y * sceneItem.height
310-
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled())
310+
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled() && UAV.batteryModuleADCConfigured())
311311

312312
Rectangle {
313313
anchors.fill: parent
@@ -334,7 +334,7 @@ Item {
334334
width: scaledBounds.width * sceneItem.width
335335
height: scaledBounds.height * sceneItem.height
336336
y: scaledBounds.y * sceneItem.height
337-
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled())
337+
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled() && UAV.batteryModuleADCConfigured())
338338

339339
Rectangle {
340340
anchors.fill: parent
@@ -361,7 +361,7 @@ Item {
361361
width: scaledBounds.width * sceneItem.width
362362
height: scaledBounds.height * sceneItem.height
363363
y: scaledBounds.y * sceneItem.height
364-
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled())
364+
visible: (!UAV.isPathPlanEnabled() && UAV.batteryModuleEnabled() && UAV.batteryModuleADCConfigured())
365365

366366
Rectangle {
367367
anchors.fill: parent

0 commit comments

Comments
 (0)