Watch
1
0
Fork
You've already forked souveraine
0

lock: surface charge rate, and stop counting down while plugged in

UPower's ChargeType (fork, read off the charger) reaches the lock line as
fast/slow charging. Discharging with the cable in is the charger resting
between top-ups, not a drain — it now reads Charged/Plugged in.
This commit is contained in:
Fimeg 2026-07-26 16:56:39 -04:00
commit 2b69957f18
4 changed files with 152 additions and 1 deletions

View file

@ -68,11 +68,23 @@ Item {
case UPowerDeviceState.FullyCharged:
return "Full " + pct + "%";
case UPowerDeviceState.Charging:
// ChargeRate.label is "Charging" unless the charger
// is doing something worth naming — fast, trickle,
// long-life. A charger that has quietly dropped to
// trickle used to look exactly like one that hadn't.
// Right after a driver rebind the pack can briefly
// report 0% while charging. Drop the number rather
// than lie.
return pct > 0 ? "Charging " + pct + "%" : "Charging";
return pct > 0 ? ChargeRate.label + " " + pct + "%"
: ChargeRate.label;
case UPowerDeviceState.Discharging:
// Discharging with the cable still in is the charger
// resting between top-ups, not the battery draining.
// Saying "Battery 94%" there — and watching it count
// down while plugged in — reads as a broken charger.
if (ChargeRate.pluggedNotCharging)
return pct >= 95 ? "Charged " + pct + "%"
: "Plugged in " + pct + "%";
return "Battery " + pct + "%";
default:
// Unknown / Empty / Pending* — show the number