fix(pi): drive canvas LEDs from guest GPIO (PinManager -> SPICE)

The Pi bridge onPinChange was a no-op, so guest GPIO writes never reached the
PinManager / SPICE solver and wired LEDs stayed dark even though user scripts
printed 'LED on'. Mirror the ESP32 branch: forward to pm.triggerPinChange so
GPIO drives the canvas. Interconnect still preserves and calls this before its
own cross-board routing.
This commit is contained in:
David Montero 2026-06-24 04:48:29 +02:00
parent 4992f808ce
commit d38ed04f85
1 changed files with 8 additions and 2 deletions

View File

@ -1072,8 +1072,14 @@ export const useSimulatorStore = create<SimulatorState>((set, get) => {
serialCallback(ch);
// Cross-board routing now handled by Interconnect (see bind below).
};
bridge.onPinChange = (_gpioPin, _state) => {
// Cross-board routing now handled by Interconnect (see bind below).
bridge.onPinChange = (gpioPin, state) => {
// Feed the guest's GPIO writes into this board's PinManager so they
// reach wired components and the SPICE solver (the LED brightness
// path) — same as the ESP32 branch. Without this the Pi could print
// "LED on" but the canvas LEDs stayed dark. Interconnect preserves
// and calls this before its own cross-board routing.
const boardPm = pinManagerMap.get(id);
if (boardPm) boardPm.triggerPinChange(gpioPin, state, 'mcu');
};
// Guest Linux finished booting (shell prompt reached). Flip piBooted so
// the workspace swaps the "Booting…" overlay for the live terminal and