battery: ensure current charge doesn't exceed full capacity (#1668)

This commit is contained in:
henrygd
2026-01-22 13:01:21 -05:00
parent 23c4958145
commit cb5f944de6

View File

@@ -65,7 +65,7 @@ func GetBatteryStats() (batteryPercent uint8, batteryState uint8, err error) {
continue
}
totalCapacity += bat.Full
totalCharge += bat.Current
totalCharge += min(bat.Current, bat.Full)
if bat.State.Raw >= 0 {
batteryState = uint8(bat.State.Raw)
}