Skip to content

Power, Battery & PWR

Battery display

AXP2101 provides fuel percentage and charging state. v7 moves battery from all main pages to ten segments at the top of SETTINGS:

  • segments = ceil(percent / 10); 0% renders zero segments.
  • Charging has a separate short marker.
  • SEED, SHOP, STAR, launch and ambient have no battery HUD.
  • The game reads only required status and does not override vendor charge targets or power-rail policy.

PWR path

PWR is not a normal ESP32 GPIO. It is the active-high conditioned EXIO4 signal from TCA9554. Firmware samples and debounces every 50 ms. After boot it must observe a full release before accepting a gesture, so a held power-on level cannot become immediate shutdown.

Short press

  • Awake: synchronous save, then ambient.
  • Ambient: restore brightness and page.
  • Never performs the current page action or passes through as touch.

Long press

DurationBehavior
2 sSoftware safe shutdown: freeze → save → read back → AXP2101 shutdown
10 sPMIC hardware fallback for a hung firmware
≈2 s while offHardware power-on

Durability barrier

text
freeze input/tick
  → update saved_at
  → encode schema/checksum
  → nvs_commit primary/backup
  → read primary bytes back
  → decode + compare
  → restart or PMIC shutdown

Any failure cancels software shutdown. The 180 ms window after successful save no longer ticks, so validated data cannot become dirty before power loss.

Physical evidence

Device logs captured complete EXIO4 press/release edges, standby and wake. Long shutdown saved taps=718 / purchases=67; after USB disconnect and hardware power-on, both matched exactly and Sparks only increased through RTC offline rewards.