In development. It changes without notice.
Topic
Shared Screen Parts
The pieces several screens draw or steer by: the header, the lock screen's clock, the Bluetooth chip, the list's motion, and the navigation with two buttons or a dial.
They take what they draw as arguments and never the context.
Files | |
| file | src/ |
| The Bluetooth link's state as one chip, drawn the same on the BLE screen and on every pairing page. | |
| file | src/ |
| The CoreInk dial grammar: one key reader and one repaint rule for every screen the ▲●▼ dial drives. | |
| file | src/ |
| The main loop's watch on the battery gauge of the header on the glass. | |
| file | src/ |
| The watch every screen keeps on its header band, tick by tick. | |
| file | src/ |
| Where a sliding list's step starts, and the two tweens that carry it. | |
| file | src/ |
| The rows one frame of a sliding list repaints, and the band a paint leaves for the next frame to narrow against. | |
| file | src/ |
| The clock on the CoreInk's retained lock face, kept current while the board is off. | |
| file | src/ |
| Single source of truth for the two-button (Stick) gesture convention. | |
| file | src/ |
| The vault's tab strip, named once for every screen that draws it. | |
Functions | |
| constexpr BleLink | kleidos:: |
| The link a published stack state and a link reading name. | |
| ui:: | kleidos:: |
| The chip that names the link: "Visible" while the device waits for a host, "Pairing" while one pairs, "Connected" once one holds the link. | |
| void | kleidos:: |
Draw kleidos::cx, cy). | |
| DialKeys | kleidos:: |
| Read one frame of the dial grammar. | |
| constexpr bool | kleidos:: |
Whether a hold gauge moving from prevPct to pct changes a 1-bit bar. | |
| bool | kleidos:: |
| Whether this board navigates with the ▲●▼ dial. | |
| void | kleidos:: |
| Keep the battery gauge of the header on the glass live, on a tick at rest. | |
| constexpr ui::Rect | kleidos:: |
| The band's old and new rows as one rectangle, clamped to the body. | |
| constexpr bool | kleidos:: |
| Whether a frame's window is where the last paint left it. | |
| constexpr Regions | kleidos:: |
| The rectangles a frame of the slide repaints. | |
| constexpr DrawnBand | kleidos:: |
| The band a frame of the slide leaves for the next frame. | |
| constexpr DrawnBand | kleidos:: |
| The band a resting paint of the list leaves for the next frame. | |
| constexpr TickVerdict | kleidos:: |
| Decide what this boot does with the tick. | |
| constexpr RtcAlarm | kleidos:: |
The alarm for the minute after utc. | |
| constexpr uint16_t | kleidos:: |
Minutes between the minute the glass shows and utc. | |
| constexpr bool | kleidos:: |
Whether the minute local gets a full refresh. | |
| constexpr uint64_t | kleidos:: |
Microseconds from seconds past the minute to one second into the next. | |
| bool | kleidos:: |
| Whether the owner shows the clock on the lock face. | |
| bool | kleidos:: |
| Store whether the lock face shows the clock. | |
| void | kleidos:: |
| Run the minute tick when the RTC alarm switched the board on. | |
| bool | kleidos:: |
| Draw the face the board sleeps under, and arm what keeps it current. | |
| void | kleidos:: |
| Arm the ESP32 timer that stands in for the RTC interrupt on USB power. | |
| void | kleidos:: |
| Draw a sleep face exactly as the board sleeps under it, arming nothing. | |
| constexpr uint16_t | kleidos:: |
| A-short = DOWN: move the selection one item toward the bottom. | |
| constexpr uint16_t | kleidos:: |
| B-short = UP: move the selection one item toward the top. | |
| bool | kleidos:: |
| A-short edge: DOWN / NEXT. Consumes the click edge. | |
| bool | kleidos:: |
| B-short edge: UP / PREV. Consumes the click edge. | |
| bool | kleidos:: |
| A-long edge: ACTIVATE / PRIMARY. Fires on release after kleidos:: | |
| bool | kleidos:: |
| B-long edge: BACK / SECONDARY. Fires on release after kleidos:: | |
| ListKeys | kleidos:: |
| Read one frame of the list grammar: taps move, holds act. | |
| constexpr uint8_t | kleidos:: |
| Fill percentage of a hold in progress. | |
| uint8_t | kleidos:: |
| Convenience: advance a kleidos:: | |
| constexpr uint8_t | kleidos:: |
| Number of pages the pager cycles through and its strip draws. | |
| constexpr uint8_t | kleidos:: |
The strip slot p occupies. | |
| constexpr Page | kleidos:: |
| B hold = next page (Credentials -> Totp -> Settings -> Credentials), skipping the 2FA page while it is hidden. | |
| constexpr Page | kleidos:: |
| Previous page (Credentials -> Settings -> Totp -> Credentials), skipping the 2FA page while it is hidden. | |
| constexpr VaultTabStrip | kleidos:: |
| The strip the vault draws. | |
| constexpr uint8_t | kleidos:: |
The logical index of tab, for the per-tab arrays. | |
Variables | |
| constexpr uint16_t | kleidos:: |
| Minutes in a day. | |
| constexpr uint16_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| Number of logical pages (the size of the per-page arrays). | |
| constexpr uint8_t | kleidos:: |
| Number of logical vault tabs (the per-tab arrays' size). | |
|
constexpr std::array< i18n:: | kleidos:: |
| The vault's three tabs' names, by VaultTab. | |
| constexpr std::array< ui::IconId, kVaultTabCount > | kleidos:: |
| The same three tabs as the marks a narrow strip draws: card, clock, menu. | |
Enumeration Type Documentation
BleLink #
BootSource #
What brought the board up, as far as the tick is concerned.
DialKeys #
HeaderRepaint #
ListKeys #
Page #
The three top-level Stick pages, cycled by a B hold.
Order is the page-switch order: a B hold advances (Credentials -> Totp -> Settings -> Credentials). The 2FA page exists only while the 2FA codes setting is on; with it off the pager is Credentials <-> Settings, and each function below takes that as totpShown.
| Enumerator | |
|---|---|
| Credentials | Credential list. Passwords only — a credential's own TOTP, when it has one, lives inside that credential's detail screen and never as a row here; the two lists are separate pages, never one merged list. |
| Totp | Dedicated browsable TOTP list. |
| Settings | Settings page (WiFi Admin, Lock, About). |
TickVerdict #
VaultTab #
Function Documentation
activateLong() #
A-long edge: ACTIVATE / PRIMARY. Fires on release after kleidos::
- Parameters
-
Name Direction Meaning btnA in, out The A nav button; its release edge is consumed.
- Returns
trueon the A-long release edge this frame.
armStandInTimer() #
Arm the ESP32 timer that stands in for the RTC interrupt on USB power.
Call before deep sleep, after prepareSleepFace armed the minute. The wake is a deadline from the reading this call takes, so it falls one second into the next minute however long the rest of the teardown runs, and wakes the board at once when that moment comes before the sleep starts. Does nothing when no minute is armed.
backLong() #
B-long edge: BACK / SECONDARY. Fires on release after kleidos::
- Parameters
-
Name Direction Meaning btnB in, out The B nav button; its release edge is consumed.
- Returns
trueon the B-long release edge this frame.
bandAfter() #
The band a frame of the slide leaves for the next frame.
Recorded only when the frame drew the rows in their resting places (no sub-row shift): rows drawn shifted mid-scroll are not where a still window puts them, so a frame that narrowed from them would leave them shifted.
- Parameters
-
Name Direction Meaning frame in The frame just drawn. covered in Something was composited over the list (a toast).
- Returns
- The band.
bandUnion() #
The band's old and new rows as one rectangle, clamped to the body.
- Parameters
-
Name Direction Meaning body in The list's body. newY in Top of the band this frame (px). oldY in Top of the band the last paint drew (px). rowH in Row height (px).
- Returns
- The rows between and including both bands; empty when they fall outside the body.
bleLinkChip() #
The chip that names the link: "Visible" while the device waits for a host, "Pairing" while one pairs, "Connected" once one holds the link.
- Parameters
-
Name Direction Meaning link in What the link is doing.
- Returns
- The chip's label and style.
bleLinkOf() #
The link a published stack state and a link reading name.
- Parameters
-
Name Direction Meaning state in The stack's published state. linked in Whether a host holds an authenticated link.
- Returns
Connectedfor a linked host,Pairingwhile the stack readsAUTHENTICATING,Visibleotherwise.
classifyBoot() #
Decide what this boot does with the tick.
A power-on is a tick only when it finds the alarm flag within the first kTickWindowSec seconds of the minute; a flag found later was left pending by something else (a reset, a flash). The USB stand-in timer is a tick once the alarm has fired, and sleeps again when it woke early while a minute is armed. Any other timer wake (a debug sleep, with no minute armed) is a normal boot.
- Parameters
-
Name Direction Meaning source in What brought the board up. alarmFired in Whether the RTC alarm flag is set. tickArmed in Whether a minute alarm is armed (its matches enabled). seconds in Seconds past the minute now (RTC).
- Returns
- The verdict.
downShort() #
A-short edge: DOWN / NEXT. Consumes the click edge.
- Parameters
-
Name Direction Meaning btnA in, out The A nav button; its click edge is consumed.
- Returns
trueon the A-short click edge this frame.
drawBleLinkChip() #
Draw kleidos::cx, cy).
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. layout in Responsive context. cx in Horizontal center. cy in Vertical center. link in What the link is doing.
drawSleepFace() #
Draw a sleep face exactly as the board sleeps under it, arming nothing.
For a capture: the clock in 1-bit at the current time, or the gray brand mark (and the gray clock when the time is not trusted).
- Parameters
-
Name Direction Meaning showClock in True for the clock face, false for the brand mark.
fullRefreshDue() #
Whether the minute local gets a full refresh.
- Parameters
-
Name Direction Meaning local in The local wall-clock time about to be shown.
- Returns
- True every kFullRefreshEveryMin minutes of the day.
gaugeRepaintOnMono() #
Whether a hold gauge moving from prevPct to pct changes a 1-bit bar.
On a 1-bit panel the gauge draws only its empty rule (at 0) and inverts its cell when full (100 or more); every step between draws the same pixels. Each e-paper repaint is a partial refresh, so a screen repaints the gauge only when this is true.
- Parameters
-
Name Direction Meaning prevPct in The gauge percent last drawn. pct in The gauge percent now.
- Returns
- True when the bar would draw different pixels.
holdPct() #
Fill percentage of a hold in progress.
- Parameters
-
Name Direction Meaning heldMs in How long the button has been down (ms). thresholdMs in Hold threshold; defaults to kleidos:: states:: twobtn:: kHoldMs.
- Returns
- 0..100, saturating at 100 once the threshold is reached.
microsToNextTick() #
Microseconds from seconds past the minute to one second into the next.
On USB power the board never loses power, so the ESP32 timer stands in for the RTC interrupt; the extra second lets the alarm fire first.
- Parameters
-
Name Direction Meaning seconds in Seconds past the minute now (0..59).
- Returns
- The timer wake delay in microseconds.
minutesSinceShown() #
Minutes between the minute the glass shows and utc.
The glass shows the minute before the armed one.
- Parameters
-
Name Direction Meaning armed in The alarm that switched the board on. utc in The RTC time (UTC) now.
- Returns
- 1 on time, more after a missed wake, 0 when nothing changed.
moveDown() #
A-short = DOWN: move the selection one item toward the bottom.
Wraps: stepping past the last item returns to the first. On a two-button device every extra press is a thumb movement, so a list that stops dead at its end forces the user to walk all the way back for the item just above the one they started on. The cycle is also what the settings tree already does, so both tabs of one pager move alike.
- Parameters
-
Name Direction Meaning selected in Current selection index. itemCount in Total selectable items (0 = nothing to move).
- Returns
- The next index, wrapping to 0 past the last item.
moveUp() #
B-short = UP: move the selection one item toward the top.
Wraps: stepping up from the first item lands on the last, which is the cheapest way to reach the end of a long list on two buttons.
- Parameters
-
Name Direction Meaning selected in Current selection index. itemCount in Total selectable items (0 = nothing to move).
- Returns
- The previous index, wrapping to the last item from 0.
nextMinuteAlarm() #
The alarm for the minute after utc.
Hour and minute are both matched, so a wake that does not happen is retried a day later, not every hour at that minute.
- Parameters
-
Name Direction Meaning utc in The RTC time (UTC) the shown minute was read at.
- Returns
- The alarm to arm.
nextPage() #
B hold = next page (Credentials -> Totp -> Settings -> Credentials), skipping the 2FA page while it is hidden.
- Parameters
-
Name Direction Meaning p in Current page. totpShown in Whether the 2FA page is drawn.
- Returns
- The next page in the cyclic order.
onDial() #
Whether this board navigates with the ▲●▼ dial.
- Returns
- The profile's dial capability (true on the CoreInk).
pageCount() #
Number of pages the pager cycles through and its strip draws.
- Parameters
-
Name Direction Meaning totpShown in Whether the 2FA codes setting is on.
- Returns
- 3, or 2 while the 2FA page is hidden.
pollDialKeys() #
Read one frame of the dial grammar.
The OK hold is read first, then the OK tap, then ▲ and ▼ on their press edge, as every three-button list reads them.
- Parameters
-
Name Direction Meaning up in, out The ▲ input; its press edge is consumed when read. ok in, out The OK input; its release edge is consumed when read. down in, out The ▼ input, or null on a board without one.
- Returns
- What the dial asked for this frame.
pollHoldGauge() #
Convenience: advance a kleidos::
Reads the button level (not an edge), so it composes with the gesture predicates above: the same press that fills the gauge still resolves to a tap or a long-press through downShort / activateLong.
- Parameters
-
Name Direction Meaning gauge in, out The gauge to advance. btn in, out The button whose pressed level is sampled.
- Returns
- The fill to publish this frame (0..100).
pollListKeys() #
Read one frame of the list grammar: taps move, holds act.
The holds are read first, so a hold's release is never also a step.
- Parameters
-
Name Direction Meaning btnA in, out The A nav button; its edges are consumed. btnB in, out The B nav button; its edges are consumed.
- Returns
- What the keys asked for this frame.
prepareSleepFace() #
Draw the face the board sleeps under, and arm what keeps it current.
The panel is woken first: an idle screen-off leaves it in deep sleep, where a flush never reaches the glass. With the clock shown and a trusted time: the next minute's alarm, then the clock in 1-bit for the same reading (the USB stand-in timer comes last, from armStandInTimer). Otherwise the face in gray, the brand mark when the owner hid the clock, and no alarm. On a critical battery the glass keeps the low-battery screen and nothing is armed. Call from the sleep path while the RTC bus is still up.
- Parameters
-
Name Direction Meaning lowBattery in True when the board sleeps because the battery is critical.
- Returns
- True when the minute tick was armed.
prevPage() #
Previous page (Credentials -> Settings -> Totp -> Credentials), skipping the 2FA page while it is hidden.
- Parameters
-
Name Direction Meaning p in Current page. totpShown in Whether the 2FA page is drawn.
- Returns
- The previous page in the cyclic order.
restingBand() #
The band a resting paint of the list leaves for the next frame.
A static paint draws the selection where a settled slide leaves it, so the first frame of the next step can narrow from it instead of repainting the whole body.
- Parameters
-
Name Direction Meaning body in The list's body. selected in The selected row. topRow in The window's first row. rowH in Row height (px). visible in Whole rows the body shows. covered in Something was composited over the list (a toast).
- Returns
- The band; not valid when the selection is off the window or the list is covered.
runIfMinuteTick() #
Run the minute tick when the RTC alarm switched the board on.
Call first thing at boot, before the HAL brings the panel up (its init clears the glass). On a tick it redraws the digits that changed, arms the next minute and cuts the power, and does not return; on a critical battery it stops the ticks instead. It returns on a normal boot, after disarming the alarm, and when the side key is pressed during the tick, so that press goes on to unlock.
setShown() #
Store whether the lock face shows the clock.
- Parameters
-
Name Direction Meaning on in True to show the clock, false for the brand mark.
- Returns
- True when the setting was stored.
shown() #
Whether the owner shows the clock on the lock face.
- Returns
- The stored setting; on when never set.
slideRegions() #
The rectangles a frame of the slide repaints.
- The window still (windowStill): the band's old and new rows.
- Otherwise (the window scrolls, no band was recorded, an overlay is up): the whole body.
- The settling frame adds the strip from the bottom of the last whole row to the bottom of the body, where the resting list differs from the slide; merged into the band's rectangle when the two touch.
- Parameters
-
Name Direction Meaning frame in The frame. drawn in The band the last paint recorded.
- Returns
- One or two rectangles inside the body.
stripSlot() #
The strip slot p occupies.
- Parameters
-
Name Direction Meaning p in Page. totpShown in Whether the 2FA page is drawn.
- Returns
- Its slot, 0-based; the hidden 2FA page answers the Credentials slot, where the pager moves a screen left on it.
tabIndex() #
The logical index of tab, for the per-tab arrays.
- Parameters
-
Name Direction Meaning tab in Logical tab.
- Returns
- Its value, 0..2.
upShort() #
B-short edge: UP / PREV. Consumes the click edge.
- Parameters
-
Name Direction Meaning btnB in, out The B nav button; its click edge is consumed.
- Returns
trueon the B-short click edge this frame.
vaultTabStrip() #
The strip the vault draws.
- Parameters
-
Name Direction Meaning totpShown in Whether the 2FA codes setting is on.
- Returns
- Credentials, 2FA and Actions; or Credentials and Actions while 2FA codes are off.
watchGlassHeader() #
Keep the battery gauge of the header on the glass live, on a tick at rest.
Paints nothing on a sleeping panel (sleeping_
- Parameters
-
Name Direction Meaning power in, out Board power manager (the battery sample).
windowStill() #
Whether a frame's window is where the last paint left it.
- Parameters
-
Name Direction Meaning frame in The frame. drawn in The band the last paint recorded.
- Return values
-
Value Meaning true No sub-row shift, the same first row, a recorded band, and nothing forcing the whole body: only the band moves.
Variable Documentation
kFullRefreshEveryMin #
Every how many minutes of the day the face gets a full refresh instead of a partial one: at every full hour, clearing what the partial updates leave.
kHoldGraceMs #
Grace period (ms) before the gauge shows any fill. A quick tap is a tap, not an aborted hold, so it must not flash a sliver of progress under the label.
kHoldMs #
Long-press threshold (ms) for A-long / B-long: the motion.longpress design token, the same value the FSM uses for kLongPressMs (asserted below) and the single named source of truth for every Stick hold.
kHoldPctStep #
Quantization step (%) of the reported fill. The gauge repaints only when it crosses a step, so a 800 ms hold costs ~20 partial repaints instead of one per frame — enough steps to read as continuous motion, few enough to leave the UI core idle between them.
kTickWindowSec #
Seconds into the minute within which a power-on is a tick: the RTC interrupt switches the board on at the minute.