Skip to content

Commit

Permalink
another cut at battery detail consumed remaining
Browse files Browse the repository at this point in the history
  • Loading branch information
kwindrem committed Jul 30, 2024
1 parent 24855ef commit 761eb92
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
18 changes: 10 additions & 8 deletions FileSets/VersionIndependent/DetailBattery.qml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ MbPage
property string batteryService: batteryServiceItem.valid ? batteryServiceItem.value : ""

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

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

VBusItem { id: minimumCellVoltageItem; bind: Utils.path(batteryService, "/System/MinCellVoltage") }
VBusItem { id: maximumCellVoltageItem; bind: Utils.path(batteryService, "/System/MaxCellVoltage") }
Expand Down Expand Up @@ -122,16 +124,16 @@ MbPage
{
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: rowTitleWidth; horizontalAlignment: Text.AlignRight
text: showCapacity ? qsTr ("Consumed") : ""}
text: showConsumed ? qsTr ("Consumed") : ""}
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter
text: showCapacity ? EnhFmt.formatValue (capacity, "AH") : "" }
text: showConsumed ? EnhFmt.formatValue (consumed, "AH") : "" }
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: rowTitleWidth; horizontalAlignment: Text.AlignRight
text: showAhRemaining ? qsTr ("Remaining") : "" }
text: showRemaining ? qsTr ("Remaining") : "" }
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter;
text: showAhRemaining ? EnhFmt.formatValue (capacity - consumedItem.value, "AH") : ""
text: showRemaining ? EnhFmt.formatValue (remaining, "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.61:
another cut at battery detail consumed remaining

v10.60:
fixed (maybe): battery detail not showing consumed and remaining with some batteries

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

0 comments on commit 761eb92

Please sign in to comment.