Module screen

Module screen 

Source
Expand description

Frame rendering shared by every display tracker.

One renderer draws every board in the class. A board contributes its panel driver, its frame buffer, and a Layout describing the geometry it can offer; what actually appears on the glass — which rows exist, what they say, where the battery sits — is decided here, so a T-Echo and a Heltec V3 disagree about pixels and about nothing else.

Every frame carries a header: the device name on the left and a battery indicator on the right. That includes the message frames (render_message) shown while pairing starts or the board shuts down — a panel that blanks its status to say “Clearing bonds…” is a panel the user has to wait on to learn anything.

§Coordinates and color

The renderer draws BinaryColor::On as foreground and clears with Off, which is what all three panels in this class already mean by those values: the e-paper’s frame buffer maps On to ink, both OLEDs map it to a lit pixel. Boards hand over a DrawTarget in natural screen coordinates and keep rotation, packing, and flushing to themselves.

§Layout model

A frame is a stack of rows text lines of one font. Row 0 is the header, row 1 is the menu cursor or the confirmation question, and the rows after that belong to the page. Gesture hints sit at the bottom of the panel and are dropped, last one first, when the page needs the room — which is how a five-row OLED and a seven-row e-paper run the same code without either one wasting a line.

Errors are swallowed throughout: a panel that fails mid-frame leaves a stale image, which is a display problem and never a protocol one.

Structs§

BatteryIconMetrics
Battery indicator geometry, in pixels.
BatteryIndicator
Charge level and charging state, as far as the board can tell.
ClockModel
A local wall-clock reading for the header.
Layout
A board’s screen geometry.
StatsModel
Radio activity, for the stats page.
StatusModel
Everything drawn that is not menu state.

Enums§

LinkState
How the board’s local link is currently reachable.
PairingState
Whether a companion can pair right now, and with what secret.

Constants§

BATTERY_SEGMENTS
How many fill segments the battery body is divided into.

Functions§

battery_segments
Number of lit segments for a known charge level, from 0 to BATTERY_SEGMENTS.
draw_battery_icon
Draw the battery indicator with its zone’s top-left corner at top_left.
render_frame
Draw the menu or the confirmation page.
render_message
Draw a short centered message — a pairing window opening, a wipe running, an alert, a farewell.