merge: trabajo pi-family paralelo + fix de swipe tactil (ramas concurrentes del submodulo)

This commit is contained in:
David Montero Crespo 2026-07-28 16:09:57 +02:00
commit ebe2ab9d5a
1 changed files with 36 additions and 23 deletions

View File

@ -238,9 +238,21 @@ export const SimulatorCanvas = ({ headerSlot }: SimulatorCanvasProps = {}) => {
// overlay owns the wiring via ProBoardDef.attachBuiltins; we hand it the DOM // overlay owns the wiring via ProBoardDef.attachBuiltins; we hand it the DOM
// element + the board's simulator/bridge handles shortly after run start // element + the board's simulator/bridge handles shortly after run start
// (the element and bridge need a beat to exist) and dispose on stop/unmount. // (the element and bridge need a beat to exist) and dispose on stop/unmount.
//
// Keyed on a STABLE run signature, not the boards array identity: `boards`
// is replaced on every serial batch (~60 Hz while output flows), and
// re-running this effect then detaches/re-attaches the peripherals in a
// loop — any event arriving inside the 500 ms re-attach window is lost
// (one-shot streams like a display list never recover, unlike the
// continuously-repainting SPI LCD decoders that masked this).
const attachKey = boards
.map((b) => `${b.id}:${b.boardKind}:${b.running ? 1 : 0}`)
.join('|');
useEffect(() => { useEffect(() => {
const cleanups: (() => void)[] = []; const cleanups: (() => void)[] = [];
boards.forEach((board) => { useSimulatorStore
.getState()
.boards.forEach((board) => {
const proDef = getProBoard(board.boardKind); const proDef = getProBoard(board.boardKind);
if (!proDef?.attachBuiltins || !board.running) return; if (!proDef?.attachBuiltins || !board.running) return;
const timeout = setTimeout(() => { const timeout = setTimeout(() => {
@ -263,7 +275,8 @@ export const SimulatorCanvas = ({ headerSlot }: SimulatorCanvasProps = {}) => {
cleanups.push(() => clearTimeout(timeout)); cleanups.push(() => clearTimeout(timeout));
}); });
return () => cleanups.forEach((fn) => fn()); return () => cleanups.forEach((fn) => fn());
}, [boards]); // eslint-disable-next-line react-hooks/exhaustive-deps
}, [attachKey]);
// Component selection // Component selection
const [selectedComponentId, setSelectedComponentId] = useState<string | null>(null); const [selectedComponentId, setSelectedComponentId] = useState<string | null>(null);