Skip to content

Show battery charge icon and external-power indicator on Ready screen #55

Description

@PurpleSentinel

Parent: #49

Summary

Add an industry-standard battery icon at the top of the Ready screen. Its fill level should represent the estimated battery percentage, and a lightning bolt should be drawn through the icon whenever USB/external power is detected.

User experience

  • Use the familiar horizontal battery outline with a positive-terminal nub.
  • Fill the inner body from left to right according to a clamped 0–100% estimate.
  • Overlay a clearly visible lightning bolt when RP2040 VBUS is present.
  • Keep the complete graphic above, and visually separate from, the centered Ready heading.
  • Preserve the current Ready-screen settings summary and start prompt.

Hardware behavior

The supported Waveshare board exposes the divided VSYS rail on GP29 (BAT_ADC). This permits a battery estimate when battery-powered. When USB is present, VSYS is supplied from VBUS and does not expose the isolated cell voltage, so firmware must not present the USB rail reading as an exact battery charge. It should use the last valid battery-only estimate when available, otherwise show a documented powered/charging fallback fill with the lightning bolt.

Acceptance criteria

  • Read and smooth GP29 ADC samples using the documented 200k/100k divider.
  • Convert battery-only voltage to a bounded percentage using a documented Li-ion estimate.
  • Detect external USB power from the RP2040 VBUS status rather than a voltage guess.
  • Draw the battery outline, proportional fill, terminal, and charging bolt with framebuffer primitives.
  • Keep the icon inside the circular display and clear of the Ready heading at all fill levels.
  • Degrade safely if ADC or power-state reads fail.
  • Add host-side tests for voltage conversion, smoothing, power detection, geometry, and Ready-screen integration.
  • Validate the final rendering and VBUS indication on the supported physical device.

Relationship

This is a focused deliverable beneath #49. Low-battery warnings and broader power-saving behavior remain tracked by the parent issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NewFeatureCandidate product capability for future development

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions