Add WiFi to RPI PicoW (and perhaps others) - #3357
Open
skandragon wants to merge 4 commits into
Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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.