Skip to content

Pico W boards: report the connected network and fix two WiFi bugs - #11646

Open
mikeysklar wants to merge 3 commits into
adafruit:mainfrom
mikeysklar:rp2-wifi-fixes
Open

mikeysklar wants to merge 3 commits into
adafruit:mainfrom
mikeysklar:rp2-wifi-fixes

Conversation

@mikeysklar

Copy link
Copy Markdown
Collaborator

What

Pico W and Pico 2 W can now report which network they joined.

Why

ap_info was missing there, and two small bugs returned wrong values.

Change Before After
wifi.radio.ap_info (fixes #11030, fixes #9323) NotImplementedError name, channel, signal, BSSID, security used to join
IP right after switching networks old network's IP new network's IP
wifi.Network.country integer 0 ''
Tested (main + this PR) Pico W Pico 2 W
Smoke test (scan, HTTP, HTTPS, ping, mDNS), 10 runs 100/100 100/100
ap_info on home, open and WPA2 networks pass pass
Right IP after switching networks (main: 0/20) 20/20 20/20
ap_info after a timed-out connect() 5/5 5/5
Same-network reconnect, median (main: 2.97 s) 3.96 s 3.97 s
1000 pings, AP start/stop x3 pass pass

Not tested: WPA3, enterprise, roaming.

Reconnecting to the same network can take up to 1 s longer.

Thanks to @shaxntanu, whose #11625 took the same approach.

Written and tested on my board farm with Claude Code.

I reviewed the diff and the results.

🤖 Generated with Claude Code

mikeysklar and others added 3 commits October 21, 2026 08:49
The raw qstr number was cast straight to an object, so Python saw the
integer 0 instead of a str.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
After stop_station() the netif kept its DHCP address while the link
was down. connect() to another network then saw the link come up with
an address already set and returned before DHCP had run, still holding
the previous network's address. Clear the address instead. DHCP keeps
its lease and asks for it again when the link returns, so the same
network re-acknowledges it and a different one refuses it and assigns
a new one.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Return the connected network instead of raising NotImplementedError.
SSID comes from the connect() call, channel, RSSI and BSSID from the
CYW43. Security reflects how connect() joined: open, or WPA2 with a
password. Returns None when the station link is not up.

Fixes adafruit#11030, fixes adafruit#9323.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant