Skip to content

Commit

Permalink
fixed: battery detail consumed and remaining incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
kwindrem committed Jul 30, 2024
1 parent 761eb92 commit cde4eff
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
18 changes: 9 additions & 9 deletions FileSets/VersionIndependent/DetailBattery.qml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ MbPage

property string batteryService: batteryServiceItem.valid ? batteryServiceItem.value : ""

VBusItem { id: capacityItem; bind: Utils.path(batteryService,"/Capacity") }
VBusItem { id: consumedItem; bind: Utils.path(systemPrefix,"/Dc/Battery/ConsumedAmphours") }
property real consumed: capacityItem.valid ? capacityItem.value : ( consumedItem.valid ? consumedItem.value : undefined )
property bool showConsumed: consumed != undefined

VBusItem { id: remainingItem; bind: Utils.path(batteryService,"/Capacity") }
property bool showRemaining: remainingItem.valid
VBusItem { id: installedCapacityItem; bind: Utils.path(batteryService, "/InstalledCapacity") }
property bool showRemaining: showConsumed && installedCapacityItem.valid
property real remaining: installedCapacityItem.value - consumed
property bool calculateConsumed: remainingItem.valid && installedCapacityItem.valid

VBusItem { id: consumedItem; bind: Utils.path(systemPrefix,"/Dc/Battery/ConsumedAmphours") }
property real consumed: calculateConsumed ? installedCapacityItem.value - remainingItem.value : consumedItem.value
property bool showConsumed: calculateConsumed || consumedItem.valid

VBusItem { id: minimumCellVoltageItem; bind: Utils.path(batteryService, "/System/MinCellVoltage") }
VBusItem { id: maximumCellVoltageItem; bind: Utils.path(batteryService, "/System/MaxCellVoltage") }
Expand Down Expand Up @@ -124,7 +124,7 @@ MbPage
{
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: rowTitleWidth; horizontalAlignment: Text.AlignRight
text: showConsumed ? qsTr ("Consumed") : ""}
text: showConsumed ? qsTr ("Consumed") : "" }
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter
text: showConsumed ? EnhFmt.formatValue (consumed, "AH") : "" }
Expand All @@ -133,7 +133,7 @@ MbPage
text: showRemaining ? qsTr ("Remaining") : "" }
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter;
text: showRemaining ? EnhFmt.formatValue (remaining, "AH") : ""
text: showRemaining ? EnhFmt.formatValue (remainingItem.value, "AH") : ""

}
}
Expand Down
3 changes: 3 additions & 0 deletions changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v10.62:
fixed: battery detail consumed and remaining incorrect

v10.61:
another cut at battery detail consumed remaining

Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v10.61
v10.62

0 comments on commit cde4eff

Please sign in to comment.