Root cause (on device): sound_engine zero-initialized i2s_pin_config_t,
leaving mck_io_num == 0. i2s_set_pin() then claimed GPIO0 — an
MCLK-capable pin on the S3 and the trackball centre / BOOT line — as
its MCLK output. Verified on device with a diagnostic build: pin0 read
LOW at idle, exactly one latched FALLING edge, clicks never registered.
- sound_engine: set pins.mck_io_num = I2S_PIN_NO_CHANGE explicitly.
- NetDeck: register the trackball click on release with contact-bounce
collapse (the proven CrtTerminal pattern); pollTouch re-arms when
isPressed() stays true but getPoint() reports no points (stuck GT911
IRQ on some units).
- Emulator parity (so this class of bug dies before flashing):
GPIO-matrix pin-ownership model in the shim — i2s_set_pin() claims
its pins, claimed pins are dead inputs (digitalRead LOW, no edges,
loud WARNING on claim/ISR collisions); host pin writes go through
emu::setPin/togglePin with an edge-accurate ISR latch (a full
press+release pulse between dispatches no longer gets swallowed);
E2E inits SDL_INIT_AUDIO so the I2S path actually runs there.
Regression coverage: e2e/trackball_click (fails on the old engine),
unit/shim_claimed_pin_is_dead_input,
unit/shim_edge_survives_same_dispatch_pulse.
- Makefile: firmware step follows the sketch move (root platformio.ini,
src_dir = src/netdeck).
- HW.md: new notes file for emulator-vs-hardware quirks and the
on-device debugging recipe.
On-device verified: clicks register in both views (beacon drops, node
routing). Fast layer 23 unit + 7 integration green. Note: e2e
boot_and_controls + network_journey failures are pre-existing at HEAD
(reproduced on a clean stash before this change).
- Replace hardcoded with in NetDeck.ino (8 occurrences)
- Add to nd_layout.h
- Update test expectations in unit_tests.h and integration_tests.h from units[6] to units[7] to match the new reinforcement slot indexing
This enables supporting more than 7 units in the future.
Replace the fading visibility[] stub with two bitmaps over the tile grid:
fogNow (visible this tick) and fogSeen (persistent historical memory),
re-derived each sim tick via revealLos() Bresenham raycasts from:
- each living marine's 8-tile sight window (= marine fire range, so the
squad never shoots into darkness), and
- each online network node uncovering its connected tiles (3-tile window).
Rendering (renderMap): never-seen -> flat dark gray, historical ->
luma grayscale via gray565(), current -> full palette. Hostiles on
non-visible tiles are hidden in renderUnits. Ad-hoc revealTile() stamps
(marine step, door/HIVE links, hand-placed airlock tiles) removed; fog
refreshes on door toggle and scenario reset.
Tests: 5 new unit tests (initial reveal, wall blocking with face render,
historical persistence, node uncover/sever, gray565 channels) plus a
regression pinning fog sight >= marine fire range.