velxio/frontend/src
davidmonterocrespo24 77bf8971ff fix(esp32): multi-servo blink — don't broadcast LEDC duty across consumers
User-reported bug (project 5218f9e3, solar-tracker with 2× ESP32
servos): when LDR values change the servos visibly oscillate between
two positions instead of moving smoothly.

Root cause in useSimulatorStore.makeLedcUpdateHandler. When the
backend emits a ledc_update with gpio=-1 (the per-channel gpio_out_sel
map isn't populated yet on the very first duty change after attach),
the handler called PinManager.broadcastPwm(duty). broadcastPwm fans
the same duty out to ALL registered PWM consumers — for a project
with two servos both subscribed in the 0.01-0.20 duty range, each
broadcast made BOTH servos mirror whichever channel was last
written. Result: servoPan→91° and servoTilt→87° alternating writes
would visibly snap both servos to 87°, then 91°, then 87°…

Two-part fix:

1. PinManager grows `pwmListenerPinCount()` — number of distinct
   pins with at least one PWM consumer registered.

2. makeLedcUpdateHandler now keeps a per-board memo of
   {ledc_channel → last-known-good-gpio}. On a gpio=-1 update:
     - if the channel has a remembered gpio, route there;
     - else, only broadcast when there's at most ONE consumer
       (single-LED / single-servo setups still work);
     - otherwise drop the update — the backend's GPIO out_sel poll
       repopulates the map within a few ms and the next ledc_update
       arrives with a real gpio.

The drop is correct because the same LEDC channel keeps emitting
duty changes every Servo.write() call (~33 Hz at 30 ms loop delay),
so missing one transient gpio=-1 frame is invisible.

Tests: 1853 pass. The existing esp32-servo-pot tests already cover
the gpio>=0 happy path; the new memo path is exercised indirectly
through that handler.
2026-05-17 04:22:11 +02:00
..
__pro_stub__ feat: add optional extension hooks for private overlays 2026-05-04 14:03:20 -03:00
__tests__ ci: Phase 1d-tests I + K + L — workflow hardening + nightly library-compile 2026-05-15 23:19:11 +02:00
assets
components fix(sensor-panel): per-sensor state when switching between same-type sensors 2026-05-16 22:28:52 -03:00
data fix(examples/pico-doom): wire ILI9341 power + MISO 2026-05-14 23:22:31 -03:00
hooks refactor(oss-split): remove auth/admin/profile frontend from OSS 2026-05-14 15:31:12 -03:00
i18n i18n: admin.users keys for "Reset agent usage" button 2026-05-14 23:29:21 +02:00
lib feat(oss): portable .vlx project export/import for self-hosters 2026-05-14 16:33:00 -03:00
pages feat(sim): Phase 1c G+F3 — retire legacy CircuitScheduler / eecircuit-engine 2026-05-15 21:46:34 +02:00
services refactor(oss-split): remove auth/admin/profile frontend from OSS 2026-05-14 15:31:12 -03:00
simulation fix(esp32): multi-servo blink — don't broadcast LEDC duty across consumers 2026-05-17 04:22:11 +02:00
store fix(esp32): multi-servo blink — don't broadcast LEDC duty across consumers 2026-05-17 04:22:11 +02:00
tokens feat(landing+theme): multiplier pricing copy + softer canvas 2026-05-13 21:02:48 +02:00
types feat(components): pro_only flag + registry merge API + picker gate hook 2026-05-05 10:33:53 -03:00
utils chore(tests): silence three noisy warnings in deploy-gate output 2026-05-16 22:39:43 +02:00
velxio-elements Add ESP32 chip demos and comprehensive tests for I2C, SPI, and UART interactions 2026-04-28 19:24:39 -03:00
App.css feat(editor): view-mode toggle, agent-chat slot, toolbar polish 2026-05-08 00:56:51 -03:00
App.tsx feat(examples): /example/<id> route with pinned URL 2026-05-15 00:14:36 -03:00
entry-server.tsx refactor: rename wokwi-libs/ → third-party/ 2026-05-03 00:58:57 -03:00
index.css feat(auth): welcome email on register + password reset via Odoo mail relay 2026-05-12 17:34:30 -03:00
main.tsx refactor(oss-split): remove auth/admin/profile frontend from OSS 2026-05-14 15:31:12 -03:00
seoRoutes.ts fix(docs): RISC-V emulation goes through QEMU, not a TypeScript browser core 2026-05-07 21:56:29 +02:00
vite-env.d.ts