Commit Graph

1 Commits

Author SHA1 Message Date
David Montero 57325aa9a9 fix(sim): a resistor divider on a sensor line made the board pin invisible
An HC-SR04 on an ESP32-S3 answered "No echo" forever the moment its ECHO
went through the 1k/2k2 divider a real 5 V sensor needs, and worked again
when the divider came out (reported on Discord, project esp32-s3-distance).
Nothing about the divider is wrong: three separate resolvers could not see
past it.

1. The wire walk treated a net as a chain. Arriving at the divider's tap it
   hopped straight across the lower resistor, hit GND, and answered "tied to
   a rail" (-1) — never looking at the OTHER wire on that same tap, where
   GPIO41 was. A rail was also allowed to end the search, so a plain pull-up
   drawn before the signal wire hid the GPIO behind it the same way. The walk
   now explores the whole node (same depth, one shared visited set) and
   treats a supply pad as the weakest answer: remembered, returned only when
   no driven pin was found anywhere.

2. The walk moved to simulation/PinTrace so the store can ask the same
   question. It pre-registered backend sensors with its own single-wire
   lookup — one wire, far end must be a board — so ECHO (landing on a
   resistor) resolved to nothing. That entry REPLACES the part's, keyed by
   pin, so the echo pin was silently dropped and the QEMU worker fell back to
   TRIG+1: it pulsed GPIO22, which nobody was reading. Both the data pin and
   the extra pins now resolve through the shared walk, so a sensor behind a
   breadboard strip or a divider registers like any other.

3. Esp32Bridge.sendPinEvent now refuses a pad a registered sensor owns, the
   guard the in-browser engines already have. connectDigitalInputsToMcu
   thresholds the solved node, and `sourcedNets` does not hold it back once
   real components sit on the net — the divider makes ECHO exactly that, and
   it solves at ~0 V because nothing models the sensor's output.

Test covers the reported circuit end to end: the walk, and the echo_pin that
reaches the start_esp32 payload.
2026-08-22 23:31:23 +02:00