velxio/frontend/src
David Montero Crespo 1800f57225 fix(micropython): stop shadowing the real WiFi driver when a NIC exists
Reported in #262: on an emulated ESP32, MicroPython's WLAN.scan() always
returned [], ifconfig() reported 10.0.2.15/10.0.2.2/10.0.2.3, and
outbound sockets raised EHOSTUNREACH — while Arduino WiFi.h on the same
board and container scanned, connected on 192.168.4.x and completed real
HTTP requests. Two independent faults, both needed for the failure.

1. The MicroPython prelude injected a stub `network` module into
   sys.modules unconditionally, so user code never reached the firmware
   driver. The stub's hardcoded ifconfig() happens to be QEMU's SLIRP
   defaults, which is why the symptom read so convincingly as a routing
   bug.

2. hasWifi survived a language switch. It is a property of the compiled
   sketch, set only by arduino-cli, but setBoardLanguageMode kept it — so
   a board compiled once as Arduino carried that verdict into a later
   MicroPython run. The source-scanning fallback only fires when hasWifi
   is undefined, so it never got a chance, and the backend attaches the
   `-nic` device only when wifi_enabled is true.

The stub is NOT removed, which is where this departs from the patch in
the issue. It exists for a reason the report didn't have: without a NIC,
`network.WLAN(STA_IF)` hangs forever waiting on peripheral status bits
QEMU never sets, tripping the FreeRTOS watchdog after ~26s. Deleting it
would trade a fake-but-working network for a hung board. It is now
conditional — real driver when a NIC is attached, stub when none is —
so both paths are honest.

Also kept: the ntptime and urequests stubs, which the issue's diff would
have dropped along with `network` (it removed the whole prelude block).
Those back 29 call sites in the 100-days gallery examples, which have no
emulated internet to reach regardless of the NIC.

The detector is now one shared function instead of two copies that could
disagree — the stub decision and the -nic decision MUST match. Folded in
`from network import WLAN`, which matched neither previous pattern: such
a sketch was judged WiFi-less and hung on the missing peripheral. The
existing tests re-implemented the detection inline, so they only ever
proved that copy self-consistent; the new ones call the shipped function.
2026-08-10 21:40:58 +02:00
..
__pro_stub__ refactor(routes): OSS is the editor; marketing moves to the overlay 2026-07-30 17:50:14 +02:00
__tests__ fix(micropython): stop shadowing the real WiFi driver when a NIC exists 2026-08-10 21:40:58 +02:00
assets
…
components feat(editor): the starter picker offers the Nano family and the ESP32-CAM 2026-08-10 21:33:55 +02:00
data feat(editor): folders - create/delete folder trees in the file explorer 2026-08-05 06:48:38 +02:00
desktop fix(editor): sync URL after New workspace + sever project identity on .vlx import 2026-07-18 08:24:06 +02:00
hooks feat(simulator): tilt and battery controls for boards that carry an IMU or a gauge 2026-08-09 23:48:56 +02:00
i18n feat(news): announce with a toast, open the modal only on request 2026-08-10 19:52:55 +02:00
lib feat(news): announce with a toast, open the modal only on request 2026-08-10 19:52:55 +02:00
pages feat(news): announce with a toast, open the modal only on request 2026-08-10 19:52:55 +02:00
services Merge remote-tracking branch 'origin/master' into v3.2-worktree 2026-08-10 17:00:24 +02:00
simulation fix(epaper): persist the window union across refreshes (fix partial-refresh tears) 2026-08-06 16:53:00 +02:00
store fix(micropython): stop shadowing the real WiFi driver when a NIC exists 2026-08-10 21:40:58 +02:00
tokens
…
types feat(sd): boards with a built-in microSD slot take user uploads 2026-08-04 05:55:21 +02:00
utils Merge remote-tracking branch 'origin/master' into v3.2-worktree 2026-08-10 17:00:24 +02:00
velxio-elements feat(breadboard): Wokwi-style parts-on-breadboard — hole snapping + invisible seating wires 2026-07-18 08:47:25 +02:00
App.css Revert "ux(editor): the pristine starter picker is a screen, not a modal" 2026-08-08 06:24:47 +02:00
App.tsx refactor(routes): OSS is the editor; marketing moves to the overlay 2026-07-30 17:50:14 +02:00
elements-register.ts feat(components): DS3231 RTC module + GPS NEO-6M NMEA talker 2026-07-31 20:38:06 +02:00
entry-server.tsx refactor(routes): OSS is the editor; marketing moves to the overlay 2026-07-30 17:50:14 +02:00
index.css
…
main.tsx Merge remote-tracking branch 'origin/master' into v3.2-worktree 2026-08-01 04:23:55 +02:00
pro fix(ui): crowded pin headers escaped the inspector - draw those labels vertically 2026-08-03 22:04:43 +02:00
seoRoutes.ts
…
vite-env.d.ts
…