velxio/frontend/src/simulation/parts
David Montero e6fdd54ba3 fix(joystick): map wokwi-analog-joystick direction (-1/0/+1) to ADC voltage
The PartSimulationRegistry handler for 'analog-joystick' was reading
`el.xValue` / `el.yValue` and computing `(value / 1023) * vcc` as if the
component were a potentiometer producing a raw 0..1023 reading.  It is
not — `@wokwi/elements/analog-joystick-element` emits xValue / yValue as
a tri-state DIRECTION signal:

  *   xValue = -1  → "left"   (mousedown on left zone)
  *   xValue =  0  → centered (mouseup snap-back)
  *   xValue = +1  → "right"  (mousedown on right zone)
  (same for yValue with up/down)

`(±1) / 1023 ≈ ±0.001`, so the ADC channel sat at ~0 V no matter which
directional zone was clicked.  Center-button clicks worked because that
path is digital (`setPinState(SEL, …)`) and bypasses the analog map.

Fix:
  * Tri-state → voltage with explicit map: -1 → 0V, 0 → Vcc/2, +1 → Vcc.
  * Vcc was hardcoded to 5V for "not RP2040" — wrong for ESP32 / S3 /
    Nano-ESP32 / etc., which all run at 3.3V like the Pi Pico.  Detect
    ESP32 via the BridgeShim's `setAdcVoltage` method and select 3.3V
    for everything that isn't pure AVR.

Reported on /example/esp32-joystick where center-button-only worked but
directional zones did nothing.  Verification via Chrome MCP after deploy.
2026-05-22 18:57:26 +02:00
..
ActiveParts.ts feat: enhance electrical simulation and testing framework 2026-04-20 16:38:31 -03:00
BasicParts.ts fix(spice+pipeline): LED visualization, INPUT_PULLUP, ESP32-C3, PWM fade, examples 2026-05-18 21:52:07 -03:00
ChipParts.ts feat(sim): Phase 5 — migrate 74HC595 shift register to PinResolver 2026-05-15 18:23:10 +02:00
ComplexParts.ts fix(joystick): map wokwi-analog-joystick direction (-1/0/+1) to ADC voltage 2026-05-22 18:57:26 +02:00
CustomChipPart.ts feat(attiny85+customchip): full ATtiny85 ADC/Timer0 + custom-chip pipeline fixes 2026-05-19 18:10:08 -03:00
EPaperPart.ts feat: add support for UC8159c (ACeP 7-colour) display 2026-04-30 00:27:40 -03:00
LogicGateParts.ts feat(sim): Phase 5 — migrate every logic-gate handler to PinResolver 2026-05-15 18:19:00 +02:00
PartSimulationRegistry.ts test(sim): Phase 1d-tests J + C — vitest.config.ts + components-metadata integrity 2026-05-15 22:58:12 +02:00
ProtocolParts.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
SensorParts.ts feat(photodiode): add lux control in sensor panel and property dialog 2026-04-24 16:42:36 +02:00
index.ts feat: Add support for SSD168x ePaper panels 2026-04-29 22:23:00 -03:00
partUtils.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00