feat: battery charging indicator (mirroring PR #537) (#1427)

## Summary

* **What is the goal of this PR?** All praise goes to @didacta for his
PR #537. Just picked up the reviewer comments to contain the changes as
suggested (there was no response for more than 6 weeks, so I wanted to
reanimate this feature).

Just one addition: should recognize usb cable plug ins / retractions and
update the icon immediately

* **What changes are included?**

## Additional Context

see #537 

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _**< NO >**_
This commit is contained in:
jpirnay
2026-03-20 04:33:29 +01:00
committed by GitHub
parent d6951f81b7
commit 71719e1d94
5 changed files with 100 additions and 58 deletions

View File

@@ -379,6 +379,12 @@ void loop() {
return;
}
// Refresh the battery icon when USB is plugged or unplugged.
// Placed after sleep guards so we never queue a render that won't be processed.
if (gpio.wasUsbStateChanged()) {
activityManager.requestUpdate();
}
const unsigned long activityStartTime = millis();
activityManager.loop();
const unsigned long activityDuration = millis() - activityStartTime;