Skip to content

Firmware: show the battery level at the top of the screen - #112

Draft
tozes wants to merge 2 commits into
Adolanium:mainfrom
tozes:firmware/battery-indicator
Draft

tozes wants to merge 2 commits into
Adolanium:mainfrom
tozes:firmware/battery-indicator

Conversation

@tozes

@tozes tozes commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Boards with a power driver can show the battery level at the top of the screen: an icon, the percentage, both, or nothing (the default). It sits in the title bar on rectangular panels, and centred at the top edge of round ones, above the UI square. The icon fills green while charging and turns red at 10% or less without USB; with the percentage alone the number changes colour. It hides without a reading or without a battery.

Each select on Settings → Battery and power moves to the next style and saves it; set battery_display icon|percentage|both|off does the same from the console. FakeHal::set now refuses keys longer than NVS allows: the first key name, battery_indicator (17 characters), failed on the device and the tests didn't notice.

Depends on #106. This branch includes those commits so it builds; review only the last commit, and it will be rebased as they merge.

Part of a series for the AMOLED-1.75C; the physical report is #103.

How you know it works

Tests on this branch (based on 8069101):

  • hermes-gadget build-sim --test: core 126/126. Drawing on rectangular and round panels, colours, the tap cycle and what it saves, the page text, and boards without a power driver.
  • pytest without the simulator-window tests (no virtual display here): 269 passed, 29 skipped.
  • pio run builds: esp32s3-touch-amoled-175c, esp32s3-touch-amoled-18, esp32s3-breadboard. CI builds every board.

Board: Waveshare ESP32-S3-Touch-AMOLED-1.75C, SKU 33691 (the unit in #103), with Hermes v0.21.6+199.g1744a19 on Fedora 44. The checks ran on builds of a working branch that combined this change with the others in this series (30f8bc0); this branch's own image was not installed on its own.

Physical: the indicator's placement on the round 466×466 panel, the tap cycle and the page text were checked on the 1.75C.

Documentation and sources

docs/using-gadget.md (settings row and a paragraph), docs/hardware.md (console keys; the percentage at the top) and a changelog line.

Checklist

  • One change per PR, with a title that says what it does
  • Relevant docs updated, or the reason no changes apply is explained
  • Verification results and remaining limitations recorded
  • Applicable vendor sources, licenses, and contributor credit retained
  • For a new board: the checklist in CONTRIBUTING.md (not a new board)

@tozes
tozes force-pushed the firmware/battery-indicator branch from 20a5152 to 42e69c4 Compare October 10, 2026 07:20
tozes added 2 commits October 10, 2026 08:22
An AMOLED pixel that is off draws no power, but the UI painted its
background near black (rgb565(10,14,20)), so every background pixel was
lit. DisplayInfo gains `emissive`; AmoledDisplay sets it (the 1.75, 1.75C
and 1.8), and Ui uses black for the background on emissive panels.
Backlit LCDs keep the near-black background, and the grey top and bottom
bars on rectangular panels stay as they are.

Test: "display: an emissive panel leaves its background unlit; a backlit
one keeps near black".
Boards with a power driver can show the battery level: an icon, the
percentage, both, or nothing (the default). It sits in the title bar on
rectangular panels and centred at the top edge of round ones, above the
UI square. The icon fills green while charging and turns red at 10% or
less without USB; with the percentage alone, the number changes colour.
It hides when there is no reading or no battery.

Each select on Settings -> Battery and power moves to the next style and
saves it; `set battery_display icon|percentage|both|off` does the same
from the console. The NVS key is `battery_display` (15 characters):
FakeHal::set now refuses keys longer than NVS allows, which caught the
first name, `battery_indicator`.

Tests in test_app.cpp: drawing on rectangular and round panels, colours,
the tap cycle and what it saves, the settings page text, and boards
without a power driver.
@tozes
tozes force-pushed the firmware/battery-indicator branch from 42e69c4 to dcec1e2 Compare October 10, 2026 07:40

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant