Skip to content

feat: one-screen dashboard — clock, CO2 gauge, temperature widgets - #21

Merged
abalawender merged 14 commits into
micropythonfrom
feat/dashboard
Dec 1, 2026
Merged

abalawender merged 14 commits into
micropythonfrom
feat/dashboard

Conversation

@abalawender

Copy link
Copy Markdown
Owner

Summary

The rotation of full-screen modes is consolidated into a single always-on dashboard:

  • Clock: 5x7 glyphs in fixed slots, so the colon never drifts; the colon is drawn as two dots between the blocks instead of using the font glyph. render.py clock ink at 230 with the panel at 80% brightness to ease the LED glare of the denser font.
  • Side widgets: CO2 bar gauge and outside temperature render into the right/left widget slots and rotate in place; the hand-off is a fast vertical roll (1 px per fast frame through all rows) that leaves the clock's colon blink untouched.
  • CO2 settling: readings are gated for the SCD41's startup transient (CO2_WARMUP_S, wall-clock anchored at the first reading), so boot no longer paints spikes into the history.
  • Module split: weather art (weather.py) and matrix rain (matrix.py) are extracted from render.py, which keeps the dashboard renderer small enough to reason about.

Verification

  • env -i HOME=$HOME PATH=/usr/bin:/bin:/usr/local/bin python3 -m unittest discover -s tests — 103 tests OK
  • python3 sim/check_demo_gif.py — both tracked GIFs match the code
  • Board-deployed and eyeballed: roll pace, colon blink, warmup behaviour
  • CI posts before/after GIFs of the changed screens

Commits are atomic and ordered as built; CI (pr-sim, micropython-check) is expected green.

abalawender and others added 10 commits November 19, 2026 09:17
Embedded glyph set (digits, '-', degree, 'C', 'O'), fixed 4 px advance
for 3-wide glyphs (narrow ones advance width+1; the degree sign is
squeezed to 2 px), exact width helper — the dashboard's temperature
face, taken from the design reference. Pixel-exact shape/advance/
ink-count tests ride along.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
render.py had grown into a junk drawer (~1100 lines) holding four
disjoint concerns. Two of them are self-contained families with their
own internal caches and no callers inside render.py, so they move out
verbatim (pixel-identical: icons + weather capture against the base
ref compare pixel-identical before/after):

- scenes.py — the weather art: the animated 10x11 forecast icon
  (kind_of, the drawn pixel rows and per-kind painters) and the
  dashboard's animated backdrop scenes (scene_for_code, _plot,
  SCENES, draw_scene), plus draw_weather which composes icon + temp.
- matrix.py — the matrix-rain family: the fixed-point drop field
  (matrix_col, tint_at, the fade/pen machinery), draw_matrix, and the
  rain-clock overlay (_clock_ink, _dissolve_draw, draw_rain_clock)
  with the embedded bitmap6 digit glyphs its ink map needs.

render.py keeps the palette and shared primitives (clear, the 3x5
overlay face, draw_clock/hilo/co2 strips, boot/message screens).
scenes.py and matrix.py import the shared palette from render.py;
render.py imports neither, so the layering stays one-directional.
deploy.sh ships the two new modules alongside render.py.

Sim naming: sim.py gains RenderFace, an attribute facade over
(render, scenes, matrix) so render_icons / the rain-clock episode /
before_after's SCREENS keep one call path for both the split modules
and a ref's self-contained render.py; run_main.run_screen_* capture
now hooks whichever module owns the screen function.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
The module it demos is matrix.py now; the file and its references in
the README and the demo-gif checker follow. Pixels unchanged.
The deploy+inspection protocol that keeps the clock running, learned
the hard way twice in one session:

- soft-reset (CTRL-D) restarts main.py without re-enumerating USB —
  make it the last operation of any REPL session
- exec after the soft-reset re-halts the loop (this is how a board ends
  up dark after a clean deploy); verify via a passive serial listen
  (open /dev/ttyACM0 read-only, expect "MPY: soft reboot" + vsys line)
- a dark matrix after a session = paused at the REPL; soft-reset fixes it
The rotation collapsed: four separate screens (dashboard, weather
detail, hi/lo, co2 strip) each hid the clock for 5 s at a stretch.
Now one home screen: the clock sits permanently in [0, WIDGET_X0 - 2),
and a single right-anchored widget (zone = render.WIDGET_X0..52, fixed
width so it never moves) rotates on a wall-clock cadence of
WIDGET_S = 8 s:

- wx: the animated forecast icon + temperature right-flush in the 3x5
  face (tint blue <= 8 C, amber above; wide negatives drop the degree
  sign instead of colliding with the icon)
- hilo: today's hi/lo in two rows of the 3x5 face (warm red / cold blue)
- co2: a small "CO2" label carrying the air-quality hue over a white
  3x5 reading (four digits = 15 px, fits the zone)

The dashboard's 2 px CO2 gauge and the creature corridor are gone (the
gauge's job moved into the co2 widget; the corridor has no room left).
render.draw_dashboard is removed — show_dashboard composes
render.draw_clock + scenes.draw_widget directly. The co2 history
screen no longer rotates; it runs only as the alarm (fresh reading >=
CO2_RED_PPM: full-screen strip + beep, as before). An untrusted RTC
draws "no ntp" in the clock zone while the widget keeps animating
instead of blanking the whole screen.

Behind text-heavy content the sparse LED matrix reads animated
backdrops as noise (solid fields show diffuser gap artifacts,
particles fight the glyphs), so the screen stays prose-black: clear,
clock, rotating widget — nothing else draws.
scenes.draw_scene/scene_for_code stay in scenes.py (sim previews and
the PR before/after machinery still use them). sim gains --screen
dashboard (rotating widgets, or --widget wx|hilo|co2 pinned) for
previewing; demo-rotation.gif is regenerated; rain-clock and icons
stay pixel-identical to the base ref.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
The preview kept drawing the backdrop scene; the board now shows
plain black. Preview mirrors main.py's show_dashboard exactly.

Generated by Mistral Vibe.

Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
The proportional bitmap6 face let the colon drift when the hour's
glyphs changed width. Every big-clock digit now sits in its own fixed
6 px slot (CLOCK_SLOT, ink centered per glyph), the HH:MM block width
is a constant (CLOCK_W), and the colon is drawn as two dots in a
reserved 2 px zone instead of the font glyph — the colon's column
never moves. matrix.py's rain-clock ink map follows the same slots.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
The SCD41's first readings after power-on can drift high — the board
showed spikes in the fresh history minutes after boot. co2.py now
gates readings for CO2_WARMUP_S = 180 s (wall-clock, anchored at the
first sample); the soft-reset path clears the gate. run_main gains
the --preseed-co2 passthrough so the sim can preview a filled
history; tests respecced around the gate.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
The denser 5x7 face reads too bright on the panel: the clock ink drops
to (230, 230, 230) and the panel brightness to 80% at boot
(gu.set_brightness — scanout-side, the framebuffer keeps full values).
Tuned by eye on the board.
Widget changes cut hard (old out, new in). Each rotation step now
rolls the outgoing widget down and the next in from the top — one
pixel per fast frame through all H+1 offsets (WIDGET_ROLL_SLEEP
paces the roll frames); the clock's colon blink ignores the roll
pace. draw_widget and the three painters take dy.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
@abalawender
abalawender force-pushed the feat/dashboard branch 3 times, most recently from 219e754 to 3f3f7c7 Compare December 1, 2026 04:53
abalawender and others added 3 commits December 1, 2026 09:07
The dashboard PR dropped the fullscreen weather pass, so the weather
capture returned zero frames and write_gif crashed with an empty list.
Screens with an empty after side are now skipped with a log note; the
rotation pseudo-screen still compares the whole loop. Also drops a
duplicated import left behind when the render modules were split.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
README still described the old four-screen rotation and the sim
example commented "clock -> weather -> hi/lo -> CO2"; it now
describes the always-on dashboard. The matrix-rain section carried
implementation lore and mangled line breaks — it says what the mode
does now. AGENTS.md's layout lists the split render modules, and its
no-board-imports rule covers them. The clock bullet states the
property (fixed slots hold the colon's column), not the bug it
prevents.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
@abalawender
abalawender force-pushed the feat/dashboard branch 3 times, most recently from 4f5c0f0 to 532155b Compare December 1, 2026 19:09
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

@/tmp/comment.md

Repository owner deleted a comment from github-actions Bot Dec 1, 2026
Repository owner deleted a comment from github-actions Bot Dec 1, 2026
Repository owner deleted a comment from github-actions Bot Dec 1, 2026
Repository owner deleted a comment from github-actions Bot Dec 1, 2026
Repository owner deleted a comment from github-actions Bot Dec 1, 2026
Repository owner deleted a comment from github-actions Bot Dec 1, 2026
Repository owner deleted a comment from github-actions Bot Dec 1, 2026
Repository owner deleted a comment from github-actions Bot Dec 1, 2026
Repository owner deleted a comment from github-actions Bot Dec 1, 2026
Repository owner deleted a comment from github-actions Bot Dec 1, 2026
Every run posted a fresh "Sim before/after" comment, so repeated
force-pushes piled one comment per run on the PR. The workflow now
finds its previous comment (github-actions[bot], "Sim before/after"
prefix) and edits it; the standing comment always shows the newest
run's GIFs and artifact link.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
@abalawender
abalawender merged commit 29a2bf6 into micropython Dec 1, 2026
2 checks passed
@abalawender
abalawender deleted the feat/dashboard branch December 1, 2026 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant