In development. It changes without notice.
Topic
Unlock Entry
How the owner enters the secret, by board: a dialed PIN, a touch keypad or a keyboard.
Each board has one of three entries, chosen when it is built, behind one interface (AuthEntryUI), so nothing else asks which one it is:
- The dial (PinEntryUI), on the CoreInk and the Sticks. A PIN is entered with one key, in the style the owner chose in settings. The Timing Arc, which is the default, is one hold for each digit: an arc fills from 0 to 9, and letting go takes the digit. The two-step ring is two: the first picks a block of digits, the second one of the block, or back. A change of style is saved only after a practice on a code that is shown, never on the PIN.
- The touch keypad (TouchAuthEntryUI), on the Core2 v1.3 and the CoreS3 SE. A PIN is typed, or a passphrase from the keypad's letters, and then confirmed.
- The keyboard (PassphraseEntryUI), on the LILYGO T-Deck and the M5Cardputer ADV. A passphrase is typed, then Enter.
Here too are the lock screen, the countdown of a lockout and the screen of a factory reset. What was entered is wiped when it is checked, when it is cancelled and when the screen is left. Neither dial style hides the PIN from somebody who watches the screen.
- See also
- Security, Application States, The boards
Files | |
| file | src/ |
| The interface every unlock entry implements: a dialed PIN, a touch keypad or a keyboard. | |
| file | src/ |
| The two lines a PIN surface shows in place of a lockout countdown that does not run, wrapped whole into the room the surface has. | |
| file | src/ |
| What a PIN surface shows while the brute-force lockout holds, and when it repaints. | |
| file | src/ |
| When a face that shows hours and minutes reads the clock again. | |
| file | src/ |
| Passphrase entry on a physical keyboard: the LILYGO T-Deck and the M5Cardputer ADV. | |
| file | src/ |
| Pure timing-arc math for the PIN-entry UI (no display coupling). | |
| file | src/ |
| Rendering collaborator for kleidos:: | |
| file | src/ |
| The Sticks' timing arc: the dial frame, its partial and incremental repaints, and the verify and result dials (part of pin_ | |
| file | src/ |
| The color three-button stepper: its digit, its key shelf, and the verify ring and result over the digit's band (part of pin_ | |
| file | src/ |
| The CoreInk's ink arc: its full frame, the per-tick dial repaint, and the verify and result dials (part of pin_ | |
| file | src/ |
| What the sources of PinEntryRenderer share: the dial's geometry and inks, and the helpers more than one rendering draws with. | |
| file | src/ |
| The lock face, the PIN entry's idle clock screen, and the one e-paper keeps through power-off (part of pin_ | |
| file | src/ |
| The two-step ring on both arc boards: its frame, its dial repaint, the newly swept slice, and the rim at rest (part of pin_ | |
| file | src/ |
| Entry of a dialed PIN, in the Timing Arc or the two-step ring. | |
| file | src/ |
| The practice code a dial-style change is proven on: drawing it, the mark under each of its digits, and the pass rule. | |
| file | src/ |
| Pure timing and state logic of the two-step ring PIN method. | |
| file | src/ |
| Draws the two-step ring: four sectors, their rim labels and the middle. | |
| file | src/ |
| Capacitive-touch unlock on one layered on-screen keyboard. | |
| file | src/ |
| Shared verify-wait and verdict vocabulary of the unlock UIs. | |
| file | src/ |
| What the unlock's verdict line says, per purpose of the entry. | |
| file | src/ |
| The two screens of the factory reset the tenth wrong secret starts: the 3-2-1 countdown and the result, laid out from the panel. | |
Functions | |
| constexpr uint8_t | kleidos:: |
The shortest passphrase an entry for purpose accepts. | |
| Notice | kleidos:: |
Set title over detail in a box width wide and maxH tall. | |
| void | kleidos:: |
Draw notice centered in box. | |
| constexpr uint32_t | kleidos:: |
| The step a panel counts the lockout down in. | |
| constexpr uint32_t | kleidos:: |
The seconds a surface prints for remainingSec. | |
| constexpr LockStatus | kleidos:: |
| What a lockout read means: how long it holds, and whether a missing device key is the cause. | |
| constexpr bool | kleidos:: |
Whether a surface names the cause of status instead of counting it down. | |
| constexpr uint32_t | kleidos:: |
The value a surface prints for status, and its repaint latch records. | |
| constexpr uint32_t | kleidos:: |
| How long after a reading the clock is read again. | |
| constexpr uint32_t | kleidos:: |
| Clamp a candidate sweep duration to the viable [min, max] window. | |
| constexpr uint8_t | kleidos:: |
| Arc fill percentage (0..100) for a hold elapsed time, given a sweep. | |
| constexpr uint8_t | kleidos:: |
| Arc fill percentage (0..100) for a hold elapsed time (default sweep). | |
| constexpr uint8_t | kleidos:: |
| Dialed digit (0..9) for a hold elapsed time, given a sweep. | |
| constexpr uint8_t | kleidos:: |
| Dialed digit (0..9) for a hold elapsed time (default sweep). | |
| constexpr uint8_t | kleidos:: |
| Dialed digit (0..9) for a debug-forced fill percentage. | |
| constexpr Code | kleidos:: |
Draw a practice code for method from rnd. | |
| constexpr Mark | kleidos:: |
The mark under digit index of code, given what was dialed. | |
| constexpr bool | kleidos:: |
Whether an entered secret dials code. | |
| constexpr Steps | kleidos:: |
| How long each quadrant of the ring takes to fill, in each stage, on this kind of panel. | |
| constexpr uint32_t | kleidos:: |
The step length of stage. | |
| constexpr uint8_t | kleidos:: |
The quadrant under the tip after a hold of elapsedMs. | |
| constexpr uint8_t | kleidos:: |
The ring's fill after a hold of elapsedMs. | |
| constexpr uint8_t | kleidos:: |
The fill an e-paper frame shows for quadrant pos: whole quadrants, the one under the tip included. | |
| constexpr uint8_t | kleidos:: |
The quadrant an e-paper frame issued after elapsedMs shows: the quadrant that starts within the next kEpaperLeadMs, so its partial refresh lands as it starts to count. | |
| constexpr Item | kleidos:: |
What quadrant pos stands for in stage. | |
| constexpr uint8_t | kleidos:: |
The block that holds digit. | |
| constexpr uint8_t | kleidos:: |
The stage-2 quadrant of digit inside its block. | |
| constexpr uint32_t | kleidos:: |
The hold that lands in the middle of quadrant pos (what a person aiming at it holds, and what the QA tooling dials). | |
| constexpr View | kleidos:: |
| The view of a ring nobody is holding. | |
| constexpr View | kleidos:: |
The view of a hold elapsedMs in. | |
| constexpr View | kleidos:: |
| The view of the lock flash after a digit was stored: the coarse ring back, full, with the stored digit in the middle for the flash only. | |
| void | kleidos:: |
| Draw the four rim labels, each over a cleared box of its own. | |
| void | kleidos:: |
Draw the band: the track, the fill to view.percent and the four sector gaps. | |
| void | kleidos:: |
Draw again the sector gaps a fill from fromPercent to toPercent painted over. | |
| void | kleidos:: |
| Draw what the middle of the ring shows. | |
| constexpr uint16_t | kleidos:: |
The eased completion of an arc lit from fromDeg to the full turn. | |
| constexpr uint8_t | kleidos:: |
| The same eased completion in the dial's percent units. | |
| constexpr ArcSpan | kleidos:: |
The lit arc of the wait ring at wait-clock clockMs. | |
| constexpr uint32_t | kleidos:: |
The frame interval at wait-clock clockMs. | |
| constexpr uint32_t | kleidos:: |
The wait clock after a frame painted sinceFrameMs after the last. | |
| constexpr uint32_t | kleidos:: |
| Milliseconds until the next frame of the wait is due. | |
| constexpr bool | kleidos:: |
Whether span lights degree deg of the ring. | |
| constexpr DirtyArcs | kleidos:: |
The arcs a frame repaints to turn the ring from before into after. | |
| constexpr int32_t | kleidos:: |
Sine of deg degrees scaled by kTrigScale, integer-only. | |
| void | kleidos:: |
Draw the wait ring: the full track, the lit span over it, the outlines. | |
| constexpr Rect | kleidos:: |
| The screen box that holds every pixel of the ring an arc can change. | |
| void | kleidos:: |
| Paint one frame of the wait: the whole ring, or only what changed. | |
| constexpr uint8_t | kleidos:: |
The table entry due tauMs into the verdict. | |
| constexpr int16_t | kleidos:: |
The keyhole's angle at table entry index. | |
| constexpr int16_t | kleidos:: |
The keyhole's angle tauMs into the verdict. | |
| constexpr MarkTone | kleidos:: |
The mark's tone at table entry index. | |
| constexpr MarkTone | kleidos:: |
The mark's tone tauMs into the verdict. | |
| constexpr bool | kleidos:: |
| Whether the verdict is over and the outcome propagates. | |
| constexpr KleidosMarkGeo | kleidos:: |
| The mark that lives in a wait ring: the ring is the logo's ring. | |
| void | kleidos:: |
| The ring a wait ring becomes at the verdict: the whole band in one hue. | |
| void | kleidos:: |
Paint one verdict frame of the mark that lives in ring. | |
| void | kleidos:: |
| Draw a status line: the verdict's glyph, then its words. | |
| constexpr VerdictWords | kleidos:: |
The verdict's words for an entry of purpose. | |
| notice_ | kleidos:: |
The countdown's column on the panel layout describes. | |
| notice_ | kleidos:: |
The result screen's column on the panel layout describes. | |
| void | kleidos:: |
| Paint one frame of the countdown: the warning fill and its column. | |
| void | kleidos:: |
| Paint the result screen: what the erase did, and that the device restarts. | |
Variables | |
| constexpr std::size_t | kleidos:: |
| Rows one part of the notice (the title or the detail) may take. | |
| constexpr uint32_t | kleidos:: |
| Seconds one repaint of the countdown covers on a color panel. | |
| constexpr uint32_t | kleidos:: |
| Seconds one repaint of the countdown covers on the e-paper panel. | |
| constexpr uint32_t | kleidos:: |
| One second, ms. | |
| constexpr uint8_t | kleidos:: |
| The last second of a minute. | |
| constexpr uint32_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| Period between two reads of a clock that is not trusted, ms. | |
| constexpr uint32_t | kleidos:: |
| Default hold duration of one full arc sweep (0→9, 0→100%), in ms. | |
| constexpr uint32_t | kleidos:: |
| Default sweep duration (alias of kArcDurationMs) for the setting. | |
| constexpr uint32_t | kleidos:: |
| Viable minimum sweep duration (ms): below this the dial is uncontrollable (digits flick past faster than a person can release). The configurable sweep setting is clamped to this floor at load and edit time. | |
| constexpr uint32_t | kleidos:: |
| Maximum configurable sweep duration (ms): a deliberately slow, easy-to-aim dial. Bounds the upper end of the stepper. | |
| constexpr uint32_t | kleidos:: |
| Step granularity (ms) the sweep-duration stepper advances by. | |
| constexpr uint32_t | kleidos:: |
| Number of dialable digits per sweep (0..9). | |
| constexpr uint8_t | kleidos:: |
| Full arc fill percentage. | |
| constexpr uint8_t | kleidos:: |
| Digits in a practice code. | |
| constexpr uint8_t | kleidos:: |
| Random words makeCode consumes. | |
| constexpr uint8_t | kleidos:: |
| Quadrants on each ring (four 90-degree sectors). | |
| constexpr uint8_t | kleidos:: |
| Position of a hold that ran past the last quadrant. | |
| constexpr uint8_t | kleidos:: |
| Number of blocks stage 1 offers (1-2-3, 4-5-6, 7-8-9, the 0 block). | |
| constexpr uint8_t | kleidos:: |
| Index of the block that holds the 0, back and erase. | |
| constexpr uint8_t | kleidos:: |
| Digits in each of the first three blocks. | |
| constexpr uint8_t | kleidos:: |
| Full ring fill percentage. | |
| constexpr uint8_t | kleidos:: |
| Holds every digit takes, whatever the digit. | |
| constexpr uint8_t | kleidos:: |
| A view with no live quadrant (idle, or past the ring). | |
| constexpr Steps | kleidos:: |
| The Sticks' steps: stage 1 keeps the arc's 300 ms, stage 2 one notch slower. | |
| constexpr Steps | kleidos:: |
| The CoreInk's steps: each holds one fast partial issued ahead. | |
| constexpr uint32_t | kleidos:: |
| How long ahead of a quadrant the e-paper issues the frame that shows it (ms): one fast partial refresh, so the frame lands as the quadrant starts to count. | |
| constexpr int16_t | kleidos:: |
| Gap between the band and the inner corner of a rim label (px). | |
| constexpr int16_t | kleidos:: |
| Width of the gap that splits two sectors (px). | |
| constexpr uint32_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| constexpr uint16_t | kleidos:: |
| A full turn of the ring (degrees). | |
| constexpr uint16_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| Wait-clock reading at which the orbit begins. | |
| constexpr uint32_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| constexpr WaitCadence | kleidos:: |
| constexpr uint16_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| Arcs a frame repaints at most: two edges move, and each may straddle 12 o'clock. | |
| constexpr uint16_t | kleidos:: |
| constexpr int32_t | kleidos:: |
| The value of sin(90 deg) in ui:: | |
| constexpr int16_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| One table entry per frame (ms): the wait's fast cadence. | |
| constexpr uint32_t | kleidos:: |
| When a right secret's stem meets the body outline and the mark turns green (ms). | |
| constexpr uint32_t | kleidos:: |
| When a wrong secret's turn stalls and the mark turns red (ms). | |
| constexpr uint8_t | kleidos:: |
| Frames of the verdict, the last one at kVerdictMs. | |
| constexpr std::array< int16_t, kVerdictSteps+1 > | kleidos:: |
| constexpr std::array< int16_t, kVerdictSteps+1 > | kleidos:: |
Enumeration Type Documentation
AuthEntryPurpose #
What an entered secret is for, so the surface can say so.
AuthUIState #
High-level state shared by both PIN and passphrase entry modes.
Center #
What the middle of the ring shows.
| Enumerator | |
|---|---|
| Empty | Nothing (idle; no digit is ever shown outside its own hold and flash). |
| Block | Stage 1 held: the live block's digits. |
| Digit | Stage 2 held on a digit, or the lock flash: that digit. |
| Back | Stage 2 held on back. |
| Erase | Stage 2 held on erase. |
| None | Stage 1 held past the ring: a release picks nothing. |
LockCause #
LockFaceKind #
Mark #
Outcome #
What a release did.
Rung #
The rung of the ladder a notice starts from (layout).
Slot #
Stage #
Function Documentation
advanceWaitClock() #
The wait clock after a frame painted sinceFrameMs after the last.
Advanced by the real time since the last frame, capped at one frame interval: a stall (a mount, a storage flush, a flash write freezing the UI core) shows as a short slow-down of the ring and never as a jump. The phase carries no information, so it may lag real time.
- Parameters
-
Name Direction Meaning clockMs in The wait clock at the last frame. sinceFrameMs in Time since the last frame. cadence in The ring's cadence.
- Returns
- The wait clock for the new frame.
aimMs() #
The hold that lands in the middle of quadrant pos (what a person aiming at it holds, and what the QA tooling dials).
- Parameters
-
Name Direction Meaning pos in Quadrant 0..3. step in Milliseconds per quadrant.
- Returns
- Milliseconds to hold.
blockOf() #
The block that holds digit.
- Parameters
-
Name Direction Meaning digit in 0..9.
- Returns
- 0..2 for 1..9, kZeroBlock for 0.
clampSweepMs() #
Clamp a candidate sweep duration to the viable [min, max] window.
- Parameters
-
Name Direction Meaning sweepMs in Candidate sweep duration in milliseconds.
- Returns
- The clamped, controllable sweep duration.
completionDeg() #
The eased completion of an arc lit from fromDeg to the full turn.
Ease-out quad over kFillMs (an entrance: it arrives and settles). The fill says "input complete", not how long anything takes, so the linear rule for progress does not apply to it.
- Parameters
-
Name Direction Meaning fromDeg in Where the arc stood when the fill began, [0, 360]. elapsedMs in Time since the fill began.
- Returns
- The lit sweep in degrees,
fromDegat 0 and 360 from kFillMs.
completionPercent() #
The same eased completion in the dial's percent units.
What the Sticks' lock flash paints after the last digit's release.
- Parameters
-
Name Direction Meaning fromPercent in Where the dial stood at the release, [0, 100]. elapsedMs in Time since the release.
- Returns
- The fill percent,
fromPercentat 0 and 100 from kFillMs.
dialedDigit() [1/2] #
Dialed digit (0..9) for a hold elapsed time (default sweep).
- Parameters
-
Name Direction Meaning elapsedMs in Milliseconds the button has been held.
- Returns
- Digit, wrapping every kArcDurationMs.
dialedDigit() [2/2] #
Dialed digit (0..9) for a hold elapsed time, given a sweep.
- Parameters
-
Name Direction Meaning elapsedMs in Milliseconds the button has been held. sweepMs in Full-sweep duration; clamped to the viable window.
- Returns
- Digit, wrapping every
sweepMs.
digitForPercent() #
Dialed digit (0..9) for a debug-forced fill percentage.
- Parameters
-
Name Direction Meaning percent in Forced fill 0..100.
- Returns
- Digit corresponding to that fill, clamped to 0..9.
draw() #
Draw notice centered in box.
Each row is centered on the box; the block is centered vertically, and one taller than the box starts at its top.
- Parameters
-
Name Direction Meaning canvas in, out Surface to draw on (inside the caller's frame). notice in The notice layout set for box.box in The box it was set for. titleColor in RGB565 color of the title rows. detailColor in RGB565 color of the detail rows.
drawBand() #
Draw the band: the track, the fill to view.percent and the four sector gaps.
Draws over whatever is there; clear the dial disc first for a repaint.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface in an open frame. geo in Ring geometry. view in What the ring shows.
drawCenter() #
Draw what the middle of the ring shows.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface in an open frame (middle cleared). geo in Ring geometry. view in What the ring shows.
drawCountdown() #
Paint one frame of the countdown: the warning fill and its column.
- Parameters
-
Name Direction Meaning canvas in, out Surface to draw on (inside the caller's frame). layout in The panel. digit in Countdown digit shown (3, 2 or 1).
drawGapsIn() #
Draw again the sector gaps a fill from fromPercent to toPercent painted over.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface in an open frame. geo in Ring geometry. fromPercent in Fill before the slice. toPercent in Fill after it.
drawResult() #
Paint the result screen: what the erase did, and that the device restarts.
- Parameters
-
Name Direction Meaning canvas in, out Surface to draw on (inside the caller's frame). layout in The panel. wiped in Whether the erase reported the vault gone.
drawRim() #
Draw the four rim labels, each over a cleared box of its own.
The boxes never reach the band (their inner corners sit kRimGap outside it), so the labels repaint without touching the ring.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface in an open frame. geo in Ring geometry. view in What the ring shows. atRest in True draws no label live (the entry is complete).
drawStatusRing() #
The ring a wait ring becomes at the verdict: the whole band in one hue.
The same annulus and outlines as drawWaitRing, so the ring does not move by a pixel when the wait ends: the idle tone's primary (the lit arc's own ink), then the success or failure hue.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. geo in The ring. tone in Its tone.
drawVerdictLine() #
Draw a status line: the verdict's glyph, then its words.
Clears row to bg, then draws the check (success) or the cross (failure) in the status hue in a square one line tall and the words in the primary text ink, bold, centered in row as one group (or from its left edge). An idle tone draws the words alone. Failure is never told by color alone: the glyph's shape and the words carry it.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. row in The line's box. tone in The verdict's tone. text in The words. font in Font role. bg in The color under the line. leftAlign in Start at row'sleft edge instead of centering.
drawWaitRing() #
Draw the wait ring: the full track, the lit span over it, the outlines.
The dial's own inks: the track in bg.accent and the span in brand.primary (6.94:1 against the track, 11.66:1 against bg.base, both past the 3:1 non-text bar), the outlines in the track's tone (kSubtle on the crisp path). One antialiased band pass on a color panel. The caller clears what lies under the ring and brackets the frame.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. geo in Center, radii and outline stroke. span in The lit arc.
epaperFramePosition() #
The quadrant an e-paper frame issued after elapsedMs shows: the quadrant that starts within the next kEpaperLeadMs, so its partial refresh lands as it starts to count.
- Parameters
-
Name Direction Meaning elapsedMs in Milliseconds the key has been held. step in Milliseconds per quadrant.
- Returns
- 0..3, or kPastRing.
fillPercent() #
The ring's fill after a hold of elapsedMs.
- Parameters
-
Name Direction Meaning elapsedMs in Milliseconds the key has been held. step in Milliseconds per quadrant (0 reads as 1).
- Returns
- 0..100, full from the end of the fourth quadrant on (nothing wraps).
flashView() #
The view of the lock flash after a digit was stored: the coarse ring back, full, with the stored digit in the middle for the flash only.
- Parameters
-
Name Direction Meaning digit in The digit just stored. stored in Digits stored, that one included.
- Returns
- The flash view.
holdView() #
The view of a hold elapsedMs in.
The middle names what a release now would pick: the live block, the digit, back or erase, or nothing past the coarse ring. The e-paper inks whole quadrants and shows the quadrant its frame is issued for, ahead of the tip (epaperFramePosition), and its first quadrant is the idle frame itself; the color boards sweep the fill continuously.
- Parameters
-
Name Direction Meaning dial in The ring's state. stored in Digits stored so far. elapsedMs in Milliseconds the key has been held. steps in The board's steps. epaper in True on the e-paper board.
- Returns
- The held view.
idleView() #
The view of a ring nobody is holding.
The color boards show the ring empty. The e-paper marks the first quadrant already, where a release before the first step lands, so the press itself needs no frame (one partial per step, issued ahead).
- Parameters
-
Name Direction Meaning dial in The ring's state. stored in Digits stored so far. epaper in True on the e-paper board.
- Returns
- The idle view.
itemAt() #
What quadrant pos stands for in stage.
Stage 1: the block, or nothing past the ring. Stage 2: the block's digits and back; the 0 block reads 0, back, erase, back; past the ring is back. Erase reads as back while erasable is false (no digit stored).
- Parameters
-
Name Direction Meaning stage in The stage. block in The block stage 2 opened (ignored in stage 1). pos in Quadrant 0..3, or kPastRing. erasable in Whether a stored digit exists to erase.
- Returns
- The quadrant's meaning.
keyholeDeciDeg() #
The keyhole's angle tauMs into the verdict.
- Parameters
-
Name Direction Meaning success in Whether the secret was right. tauMs in Time since the verdict began.
- Returns
- The angle, tenths of a degree.
keyholeDeciDegAt() #
The keyhole's angle at table entry index.
- Parameters
-
Name Direction Meaning success in Whether the secret was right. index in The entry (clamped to kVerdictSteps).
- Returns
- The angle, tenths of a degree.
layout() #
Set title over detail in a box width wide and maxH tall.
Takes the first setting of the ladder (heading / body, body / body, body / small, small / small) in which no word is wider than the box, every word of both parts lands on a row, and the block is no taller than maxH; when none is, the last setting, with fits false. A part is never ellipsized; in that last setting a word wider than width is split across rows and a part longer than kMaxRows rows drops the words past them.
- Parameters
-
Name Direction Meaning canvas in Surface used only to measure text. title in NUL-terminated UTF-8 cause (nullptr sets no title). detail in NUL-terminated UTF-8 detail (nullptr sets no detail). width in Width of the box, in pixels. maxH in Height of the box, in pixels. gap in Space between the title and the detail, in pixels. firstRung in The setting the ladder starts from: Rung::Body skips the heading and the body / body settings, for a block that reads under another (the attempt count under a lockout).
- Returns
- The notice to draw.
layoutCountdown() #
The countdown's column on the panel layout describes.
- Parameters
-
Name Direction Meaning canvas in Surface used only to measure text. layout in The panel. digit in Countdown digit shown (3, 2 or 1).
- Returns
- Where the rows of the title, the reason and the digit land.
layoutResult() #
The result screen's column on the panel layout describes.
- Parameters
-
Name Direction Meaning canvas in Surface used only to measure text. layout in The panel. wiped in Whether the erase reported the vault gone; false names a failure instead, because records are still on flash.
- Returns
- Where the rows of the outcome and the restart line land.
litAt() #
Whether span lights degree deg of the ring.
- Parameters
-
Name Direction Meaning span in The lit arc. deg in A degree clockwise from 12 o'clock, [0, 360).
- Returns
truewhen the degree lies on the lit arc.
makeCode() #
Draw a practice code for method from rnd.
Two holds: one 0 and one digit from each of 1-3, 4-6 and 7-9, shuffled. One hold: one 0, one digit from 7-9 and two digits from 1-9, shuffled. Every choice takes one word modulo its range, so the draw is uniform enough for a code that guards nothing.
- Parameters
-
Name Direction Meaning method in The method being practiced. rnd in kRandomWords random words.
- Returns
- The code.
markAt() #
The mark under digit index of code, given what was dialed.
- Parameters
-
Name Direction Meaning code in The code shown. entered in The digits dialed so far (only the first countread).count in How many digits were dialed. index in The code position, 0..3.
- Returns
- Its mark.
markInRing() #
The mark that lives in a wait ring: the ring is the logo's ring.
- Parameters
-
Name Direction Meaning ring in The wait ring.
- Returns
- The mark, its ring's mid radius inside the ring band.
msUntilWaitFrame() #
Milliseconds until the next frame of the wait is due.
- Parameters
-
Name Direction Meaning clockMs in The wait clock at the last frame. sinceFrameMs in Time since the last frame. cadence in The ring's cadence.
- Returns
- 0 when a frame is due now, else the time left.
namesCause() #
Whether a surface names the cause of status instead of counting it down.
- Parameters
-
Name Direction Meaning status in The lockout read.
- Return values
-
Value Meaning true A lock holds for a missing device key. false No lock holds, or the counter's lock counts down.
nextReadInMs() #
How long after a reading the clock is read again.
- Parameters
-
Name Direction Meaning trusted in The reading met the trust the face asks for. seconds in Seconds past the minute of the reading (0..59).
- Returns
- Milliseconds until the next read.
paintVerdictFrame() #
Paint one verdict frame of the mark that lives in ring.
A whole frame clears the ring's disc to bg and draws the status ring and the mark's body with the keyhole at the frame's angle: a partial repaint at the base clock (the frame clock is for full-frame composes and popup cards only), measured at about 55 ms on the StickS3 and 39 to 85 ms on the StickC Plus2, the cost of two such frames per verdict. A keyhole frame clips to keyholeRepaintBox, clears it and draws the body and the keyhole again there, so it costs that box alone. The caller brackets the frame.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. ring in The ring the mark lives in. bg in The color under the ring. frame in The frame (VerdictClock:: step).
paintWaitFrame() #
Paint one frame of the wait: the whole ring, or only what changed.
A whole frame clears the ring's disc to bg and draws the ring at span. Otherwise the same clear and ring are drawn once per arc of dirty with the canvas clipped to that arc's waitArcWindow, so the frame costs what it changes and every pixel it touches comes out as a whole repaint draws it. The caller brackets the frame.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. geo in The ring. bg in The color under the ring. span in The lit arc of the frame. dirty in What the frame repaints (WaitRingClock:: step). mark in The Kleidos mark's body and upright keyhole to draw inside the ring after it, or nullptr for an empty ring. A whole frame draws it; a window draws it only where the window reaches its body.
passes() #
Whether an entered secret dials code.
- Parameters
-
Name Direction Meaning code in The code shown. secret in The entered digits as ASCII. len in Their count.
- Returns
- True on an exact match.
passphraseMinFor() #
The shortest passphrase an entry for purpose accepts.
- Parameters
-
Name Direction Meaning purpose in What the passphrase is for.
- Returns
- The backup floor for the backup purposes, the set floor for a new vault secret, else the floor of a secret being tested.
position() #
The quadrant under the tip after a hold of elapsedMs.
- Parameters
-
Name Direction Meaning elapsedMs in Milliseconds the key has been held. step in Milliseconds per quadrant (0 reads as 1).
- Returns
- 0..3, or kPastRing once the hold ran past the fourth quadrant.
progressPercent() [1/2] #
Arc fill percentage (0..100) for a hold elapsed time (default sweep).
- Parameters
-
Name Direction Meaning elapsedMs in Milliseconds the button has been held.
- Returns
- Fill percentage, wrapping every kArcDurationMs.
progressPercent() [2/2] #
Arc fill percentage (0..100) for a hold elapsed time, given a sweep.
- Parameters
-
Name Direction Meaning elapsedMs in Milliseconds the button has been held. sweepMs in Full-sweep duration; clamped to the viable window.
- Returns
- Fill percentage, wrapping every
sweepMs.
quadrantFill() #
The fill an e-paper frame shows for quadrant pos: whole quadrants, the one under the tip included.
- Parameters
-
Name Direction Meaning pos in Quadrant 0..3, or kPastRing.
- Returns
- 25, 50, 75 or 100.
quadrantOf() #
The stage-2 quadrant of digit inside its block.
- Parameters
-
Name Direction Meaning digit in 0..9.
- Returns
- 0..2.
shownSeconds() #
The seconds a surface prints for remainingSec.
Rounded up to a multiple of stepSec, so the value shown is never less than the time the lock still holds; 0 stays 0. Saturates at UINT32_MAX.
- Parameters
-
Name Direction Meaning remainingSec in Seconds the lockout still holds. stepSec in Step of the panel (stepSecFor); 0 or 1 shows the seconds as they are.
- Returns
- The seconds to print.
shownValue() #
The value a surface prints for status, and its repaint latch records.
The seconds as shownSeconds rounds them; 0 for a lock that names its cause, which counts nothing down, so its notice paints once however the seconds read.
- Parameters
-
Name Direction Meaning status in The lockout read. stepSec in Step of the panel (stepSecFor).
- Returns
- The value to print, or 0 for a named cause.
sinScaled() #
Sine of deg degrees scaled by kTrigScale, integer-only.
Bhaskara I's approximation, 4x(180-x) / (40500 - x(180-x)) on each half turn, within 0.2 % of full scale: enough to bound a repaint window, which carries a margin of its own.
- Parameters
-
Name Direction Meaning deg in Angle in degrees (any integer).
- Returns
- sin(deg) * kTrigScale.
statusOf() #
What a lockout read means: how long it holds, and whether a missing device key is the cause.
A lock read on a chip whose device key is missing is that key's lock: the counter it would come from cannot be authenticated without the key, so the read failed closed. With the key present the lock is the counter's.
- Parameters
-
Name Direction Meaning remainingSec in Seconds the lock holds (the guard's read). deviceKeyMissing in Whether the build binds the vault to a device key this chip does not hold.
- Returns
- The status the surfaces show; not locked when
remainingSecis 0.
stepMs() #
The step length of stage.
- Parameters
-
Name Direction Meaning steps in The board's steps. stage in The stage being held.
- Returns
- Milliseconds per quadrant (never 0).
stepSecFor() #
The step a panel counts the lockout down in.
- Parameters
-
Name Direction Meaning epaper in Whether the panel is e-paper.
- Returns
- kEpaperStepSec on e-paper, kColorStepSec otherwise.
stepsFor() #
How long each quadrant of the ring takes to fill, in each stage, on this kind of panel.
- Parameters
-
Name Direction Meaning epaper in True on the e-paper board.
- Returns
- Its two step lengths.
verdictDone() #
Whether the verdict is over and the outcome propagates.
- Parameters
-
Name Direction Meaning tauMs in Time since the verdict began.
- Returns
truefrom kVerdictMs on.
verdictIndex() #
The table entry due tauMs into the verdict.
- Parameters
-
Name Direction Meaning tauMs in Time since the verdict began.
- Returns
- tau / 20, at most kVerdictSteps.
verdictTone() #
The mark's tone tauMs into the verdict.
- Parameters
-
Name Direction Meaning success in Whether the secret was right. tauMs in Time since the verdict began.
- Returns
- The tone.
verdictToneAt() #
The mark's tone at table entry index.
- Parameters
-
Name Direction Meaning success in Whether the secret was right. index in The entry.
- Returns
- Idle before the tint (300 ms right, 160 ms wrong), the outcome's tone from it.
verdictWords() #
The verdict's words for an entry of purpose.
- Parameters
-
Name Direction Meaning purpose in What the secret is for. kind in The kind of secret the entry takes (names a wrong one).
- Returns
- The success and failure lines.
waitArcWindow() #
The screen box that holds every pixel of the ring an arc can change.
The box of the annular sector between arc's ends, from inside the inner outline to outside the outer one, with kWaitWindowMarginPx to spare. A sector's extremes lie at its two ends or where it crosses an axis, so those points bound it.
- Parameters
-
Name Direction Meaning geo in The ring. arc in The arc, as waitDirtyArcs gives it.
- Returns
- The box, in screen pixels.
waitDirtyArcs() #
The arcs a frame repaints to turn the ring from before into after.
Every degree whose lit state differs between the two spans, widened by kDirtyPadDeg on each side so an edge's feather is inside. A pixel outside every arc is drawn the same in both frames, so repainting the arcs alone gives the frame a whole repaint would. Past kMaxDirtyArcs arcs or kWholeRingDirtyDeg degrees the answer is the whole ring.
- Parameters
-
Name Direction Meaning before in The span the ring shows now. after in The span the frame paints.
- Returns
- The arcs to repaint (none when nothing changed).
waitFrameMs() #
The frame interval at wait-clock clockMs.
- Parameters
-
Name Direction Meaning clockMs in The wait clock. cadence in The ring's cadence.
- Returns
- The cadence's fast interval through the fill and the turn-in, its orbit interval after.
waitSpan() #
The lit arc of the wait ring at wait-clock clockMs.
Three phases, none of which jumps at its hand-off:
- fill, [0, kFillMs): the arc grows from
fromDegto the full ring; - turn-in, [kFillMs, kOrbitStartMs): the front edge turns at one turn per kSpinPeriodMs and the back edge at twice that, so the ring shortens from 360 deg to kSpinSegmentDeg as it starts to turn;
- orbit, from kOrbitStartMs: the segment turns at one turn per kSpinPeriodMs until the verdict.
At kFillMs both formulas give the full ring from 12 o'clock, and at kOrbitStartMs both give the segment from 6 o'clock.
- Parameters
-
Name Direction Meaning fromDeg in Where the fill starts, [0, 360] (0 for an empty ring). clockMs in The wait clock (see WaitRingClock).
- Returns
- The lit arc.
Variable Documentation
kDirtyPadDeg #
Degrees a repaint reaches past each degree whose lit state changed. An edge's antialiased feather is about one pixel, under 2 deg on the smallest ring band; the rest covers the whole-degree angle a pixel is judged by.
kFastFrameMs #
Frame interval of the fill and the turn-in (ms): the back edge moves at 600 deg/s there, and 20 ms holds it to the orbit's 12 deg step.
kFillMs #
Length of the fill that completes the ring at submission (ms): motion.fade, which on the Sticks is also exactly the lock flash, so the fill adds no time.
kKeyTurnOkDeciDeg #
The keyhole's angle on a right secret, tenths of a degree clockwise on the screen, one entry per kVerdictFrameMs, 900 sin(pi smootherstep(t / 600)), out to 90 deg at 300 ms and home at 600 (the teaser's turn, compressed from 880 ms).
kKeyTurnWrongDeciDeg #
The keyhole's angle on a wrong secret: the same curve to 160 ms (33.6 deg, the stall), then the rattle about rest, -15 deg at 240 ms (ease-out from the stall), +9 at 320, -5 at 380, +2 at 440 and 0 at 500 (smoothstep between the extremes), still to 600.
kResultDwellMs #
The beat before the outcome propagates (ms): the verdict's length, which lets the keyhole's turn and the words be read before the screen moves on.
kRingCadence #
The cadence of the dial rings (the Sticks' dial, the three-key stepper, the touch keypad): 12 deg per frame.
kRollPollMs #
Period between two reads during the last second of a minute, ms: the longest a new minute waits to be painted.
kSpinFrameMs #
Frame interval of the orbit (ms): 12 deg per frame at one turn per kSpinPeriodMs, within 15 arcmin on every ring any board draws.
kSpinPeriodMs #
One turn of the orbiting segment (ms): motion.spin. The slowest period that still reads as a loading circle, and the fastest at which one 40 ms frame keeps the largest ring's step (the touch ring) within 15 arcmin.
kSpinSegmentDeg #
Length of the orbiting segment (degrees): a quarter of the track, the same share the indeterminate progress card's segment takes of its bar.
kTurnInMs #
Length of the turn-in (ms). The arc's front edge turns at the orbit's speed and its back edge at twice that, so the full ring shortens into the segment while it starts to turn; the back edge gains the 270 deg it has to close in this long.
kVerdictMs #
The verdict's length (ms): the keyhole turns, then the outcome propagates. No final hold: the same 600 ms as the result disc it replaced, read from the real clock, so a right and a wrong secret take the same time.
kWaitWindowMarginPx #
Pixels a repaint window reaches past the ring band on each side: the outlines' antialiased feather and the rounding of the bound.
kWholeRingDirtyDeg #
Repainted degrees past which a frame repaints the whole ring instead: the windows would cover most of it anyway.