Module led

Module led 

Source
Expand description

LED sequence engine.

Owns the heartbeat (always-on; never suppressed) and arbitrates one-shot sequences layered on top: power-on, power-off, location advert.

Pure logic over a monotonic-millisecond clock. The engine reports the LED state to apply right now and the absolute time at which the caller should re-invoke LedEngine::tick for the next transition. No async, no I/O — fully unit-testable with synthetic time.

§Heartbeat semantics

The heartbeat is anchored at the engine’s start time. After every heartbeat_interval, the LED pulses for heartbeat_pulse (defaults: 2 s and 50 ms). When a one-shot sequence is active it preempts the heartbeat for the sequence’s duration; once the sequence completes the heartbeat resumes on its original rhythm (i.e. it is not re-anchored), so the user-perceived 2-second cadence stays consistent across overlays.

Structs§

BrightnessDecision
PWM brightness decision for the T1000-E’s state-aware indicator.
LedDecision
The result of a LedEngine::tick: the LED state to apply now and the absolute monotonic-millisecond deadline at which to tick again.
LedEngine
LED sequence engine.
LedTimings
Tunable heartbeat timings.
Pattern
A pre-computed LED pattern. steps is an alternating list of durations starting with the ON phase: [on_0, off_0, on_1, off_1, ...].
T1000eLedEngine
State-aware T1000-E LED policy. One-shot confirmations preempt persistent state; Charging and Low Battery preempt Attention; Attention replaces only the ordinary heartbeat.

Enums§

LedSequence
A one-shot LED flash sequence.

Constants§

DIM_FULL_MLUX
Illuminance at or above which the indicator runs at full brightness: 10 lux, in millilux.
DIM_MIN_PERMILLE
The dimming floor, in permille of normal brightness: 1/20th. Reached at zero illuminance.

Functions§

ambient_dim_permille
Ambient dimming scale, in permille of normal brightness: 1000 at or above DIM_FULL_MLUX, falling linearly to DIM_MIN_PERMILLE at zero. None — no reading yet — is full brightness, so a board whose sensor never answers keeps its ordinary indicator.