seedhammer-v1-companion/cmd/emulator
mineracks cf68d6c451 emulator: wake the Events() select on SDCard push
Eject button wasn't taking effect immediately because Platform.Events()
was blocked in a select that only woke on button-channel input or
timer expiry. SDCardEvents go through a separate pending queue and the
select had no way to notice when they arrived — the eject sat in
pending until the next button press or timer expiry, both of which
could take seconds.

Fix: 1-buffered wake channel. signalWake() pokes it (non-blocking),
the select now reads from it as a third case, and the drain-loop at
the end re-drains pending so any event pushed while we waited gets
returned in the same call.

  exportSetSDCard() calls signalWake() after appending to pending.
  Wakeup() (gui.Platform method, previously no-op) now also calls it,
  so any future gui-side wake request works the same way.

The bug was specific to non-button events — button events go through
the events chan directly so they always woke the select.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-28 21:09:58 +10:00
..
emulator_host.go #4 v1 emulator scaffolding — boots in browser 2026-05-28 20:38:43 +10:00
main.go emulator: wake the Events() select on SDCard push 2026-05-28 21:09:58 +10:00