fix(console+studio): re-enable live 0x84 pattern preview#151
Conversation
Both consoles avoided fetching pattern bytes via GET_PATTERN_FILE (0x84) for the picker preview because it used to stall the link on a slow/stalled host. The Arena-Firmware bug is now fixed in reiserlab/LED-Display_G6_Firmware_Arena#16 (chunked, non-blocking transfer with a bounded stall recovery). Restoring the live preview now that the firmware handles it safely. arena_console.html: - __populateFromSdCard and the tp-pat-name change handler now call renderSdPreview() (full-frame thumbnail, hover-to-animate) instead of the metadata-only renderSdMetaCard() that had replaced it as a workaround. renderSdMetaCard/metaCard are left defined but unused. - v8 -> v9. arena_studio.html: - patByteSource(sd, idx) gains a fallback: when a pattern's bytes aren't already cached (this-session upload, built-in library, or a loaded course-repo protocol), fetch them live via Studio.session.sendBulkRead(Wire.encodeGetPatternFile(idx)) — the same 0x84 call the SD table's Download button already makes. Previously any pattern already on the card from a prior session had no preview at all. - renderPatThumb passes the pattern's SD index through to the new fallback; tooltip and a stale comment updated to describe the new in-memory-then-live-fetch behavior. - v0.5 -> v0.6.
|
Reviewed and hardware-tested against the fixed firmware (reiserlab/LED-Display_G6_Firmware_Arena#27 head, which merged the #16 fix plus review follow-ups). Code review: clean. The three subtle paths all check out: Hardware verification (macOS bench, Chrome + WebSerial, console): uploaded a pattern via SD Upload, and the live 0x84 preview rendered end-to-end — 20-frame grating thumbnail in the annular projection, However, testing surfaced a pre-existing macOS/Chrome Web Serial reliability problem — not a regression of this PR — silent byte loss during bulk reads, which intermittently breaks both the live previews and the existing SD-table Download button on macOS hosts. Full evidence, upstream Chromium references (WICG/serial#164/#166), and a one-line Given the transport issue is pre-existing and tracked separately, this PR looks mergeable as-is to me — with #153 as the follow-up for macOS reliability (relevant if any course benches run Macs). 🤖 Generated with Claude Code |
Summary
arena_console.html(renderSdPreview, fetched viaGET_PATTERN_FILE/ 0x84), which had been swapped for a metadata-only placeholder as a workaround for a controller bug where a stalled host could wedge the link on a 0x84 transfer.arena_studio.html's Console-view pattern picker with the same capability:patByteSource()now falls back to a live 0x84 fetch for any (previously previews only worked for patterns uploaded in the current session, the built-in library, or a loaded course-repo protocol).GET_PATTERN_FILEchunked and non-blocking with a bounded stall-recovery timeout.Test plan
pixi run test(no JS logic in the shared modules changed, so no new automated coverage. This is UI wiring against existing, unit-tested bridge functions)arena_console.htmlserved viapython -m http.server, connected over WebSerial, selected an SD-card pattern uploaded in a prior session: thumbnail renders and animates on hover for multi-frame patterns.arena_studio.htmlConsole view, same scenario: thumbnail renders for a pattern never uploaded this session (previously blank).Dependency
Requires the controller to be running the fixed
GET_PATTERN_FILEhandler from reiserlab/LED-Display_G6_Firmware_Arena#16 (chunked, non-blocking, bounded stall recovery).