fix(sim): wire ATtiny85 PBx pin edges into the SPICE mixed-mode loop

arduinoPinToName() had no ATtiny85 case, so pin 1 reverse-mapped to "1"
instead of "PB1" (the wire/netlist name). The MCU-edge listener was never
attached (name not in pinsInCircuit) and the SPICE V-source was never altered
on digitalWrite, so a blink LED's branch current stayed at its HIGH value —
the LED latched ON and never turned off (and analogWrite duty changes never
re-solved). Map attiny85 pin N -> "PBN", mirroring pinNameToArduinoPin.
This commit is contained in:
David Montero 2026-06-19 05:15:26 +02:00
parent c0b1e577b4
commit 06f672f47f
1 changed files with 9 additions and 0 deletions

View File

@ -84,6 +84,15 @@ export function connectMcuEdgesToService(service: CircuitSimulationService): ()
if (boardKind.startsWith('esp32')) {
return `GPIO${arduinoPin}`;
}
// ATtiny85 wires reference port-style names (PB0..PB5), matching the
// netlist pin names from collectPinStates. Without this, the reverse
// mapping returns "1" instead of "PB1", so the MCU-edge listener is
// never attached (pin name not in `pinsInCircuit`) and the SPICE
// V-source is never altered on digitalWrite LOW — the LED latches ON
// (and analogWrite duty changes never re-solve). See pinNameToArduinoPin.
if (boardKind === 'attiny85') {
return `PB${arduinoPin}`;
}
return String(arduinoPin);
}