Skip to content

Add WiFi to RPI PicoW (and perhaps others) - #3357

Open
skandragon wants to merge 4 commits into
meshcore-dev:devfrom
skandragon:feat/picow-wifi-ble
Open

Add WiFi to RPI PicoW (and perhaps others)#3357
skandragon wants to merge 4 commits into
meshcore-dev:devfrom
skandragon:feat/picow-wifi-ble

Conversation

@skandragon

Copy link
Copy Markdown

Closes #3355

SerialWifiInterface had no ESP32-specific code in it, so I moved it to helpers/wifi and reused it as-is. The RP2040 side needed guards around three ESP32-only calls (setInhibitSleep, onEvent, setAutoReconnect) and polls WiFi.status() instead, since arduino-pico has no event callbacks or reconnect().

Quirks:

  • WiFi.begin() appears to block while the join happens (up to 15s), which stalls the mesh loop. beginNoBlock() only skips the DHCP wait, so retries are capped at 5s and spaced 30s apart. Comment in the code explains it.
  • The reconnect timer has to be stamped in setup(), otherwise the first loop() tears down an association that's still finishing DHCP.

Also added runtime WiFi credentials, since a Pico W has no display and no way to reach the rescue CLI. "set wifi.ssid" / "set wifi.pwd" persist to NodePrefs, with the build-time values as fallback. These work on any WiFi build; on RP2040 the config CLI runs on USB serial (nothing else is using it there), elsewhere it's the existing button-triggered rescue CLI.

Tested on a Pico W: joins, gets DHCP, and the companion protocol works over TCP (DEVICE_QUERY and APP_START both answer). Credentials survive a reboot. Also built Heltec V3 wifi/ble/repeater and RAK4631 BLE to check nothing else broke. I have not tested those, however, as I do not own those devices.

SerialWifiInterface has no ESP32-specific code, so move it to
helpers/wifi and reuse it on RP2040. Guard the ESP32-only WiFi
event/auto-reconnect calls and poll link state on RP2040 instead.

Claude-Session: https://claude.ai/code/session_01MqZruyfb2RkNZorHcBg4P9
Store ssid/pwd in NodePrefs and set them with 'set wifi.ssid' /
'set wifi.pwd' over USB serial; build-time WIFI_SSID/WIFI_PWD stay as
the fallback. Headless WiFi builds get the config CLI on Serial, which
is otherwise unused there.

Claude-Session: https://claude.ai/code/session_01MqZruyfb2RkNZorHcBg4P9
arduino-pico's WiFi.begin() blocks for up to 2x its 15s timeout, which
stalled the mesh loop on every reconnect attempt; use beginNoBlock().
Log the IP when the link comes up, and the status code when retrying.

Claude-Session: https://claude.ai/code/session_01MqZruyfb2RkNZorHcBg4P9
- scope the serial config CLI to RP2040; it was exposing the rescue CLI
  (cat/rm/erase) on every ESP32 WiFi build, which gates it behind a
  physical long-press
- bound and space out RP2040 rejoins: the core's join busy-waits, so cap
  it at 5s and retry every 30s instead of every 10s
- stamp the reconnect timer in setup(), so the first loop() doesn't tear
  down an association that is still finishing DHCP
- treat stored credentials as a pair, and pass NULL (not "") for an open
  network
- teach build_as_lib.py where SerialWifiInterface moved

Claude-Session: https://claude.ai/code/session_01MqZruyfb2RkNZorHcBg4P9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant