Module attention

Module attention 

Source
Expand description

Display-attention policy: when the device should stop assuming the user is looking at it.

Both panel technologies lapse after a period of inactivity; what lapsing does differs, because their costs differ:

  • DisplayKind::Emissive (OLED) burns current for as long as it is lit, so lapsing turns the panel off — via a dimmed warning state first, so it reads as going to sleep rather than dying.
  • DisplayKind::Persistent (e-paper) costs nothing to keep readable, so it stays visible. Lapsing instead collapses the menu back to its home page.

The shared part is the one that matters to the user: after a while away, the device forgets what you were in the middle of, and the next press starts from a page whose meaning is visible. Both kinds therefore send the menu home on Transition::Lapsed (see crate::menu::UiModel::go_home); only emissive panels also cut power.

§Driving it

  1. Call Attention::wake on every event that means “the user is here or wants to be”: a button press (on the press edge, not the release), a BLE connection-state change, an opening pairing window, an alert, a low-battery notice.
  2. Call Attention::set_hold for conditions that must stay visible for as long as they last, such as a pairing window showing a PIN.
  3. Call Attention::poll when Attention::next_deadline elapses, and act on any Transition it returns.

Content changes that are not the user’s doing — a battery sample, a bond count — must not call wake. Redraw them only while Attention::accepts_redraw is true, or a board that samples its battery on a timer will never let its panel sleep.

Structs§

Attention
Display-attention state machine.
AttentionConfig
Timing policy. Held by value so a board can adjust it at runtime — the plumbing a future PROP_DISPLAY_TIMEOUT needs.

Enums§

DisplayKind
How the board’s panel behaves when it is not being looked at.
DisplayState
What the panel is currently doing.
HoldReason
A condition that pins the display awake for as long as it holds.
Transition
A state change the owning task has to act on.