[wifi] Revert cyw43_wifi_link_status change for RP2040

The switch from cyw43_tcpip_link_status to cyw43_wifi_link_status
was intended for 2026.3.0 alongside the arduino-pico 5.5.0 framework
update but was accidentally included in 2026.2.3.

With the old framework (3.9.4), cyw43_wifi_link_status never returns
CYW43_LINK_UP, so the CONNECTED state is unreachable. The device
connects to WiFi but the status stays at CONNECTING until timeout,
causing a connect/disconnect loop.

Fixes https://github.com/esphome/esphome/issues/14422
This commit is contained in:
J. Nick Koston
2026-03-02 16:39:01 -10:00
committed by Jesse Hills
parent c4fa476c3c
commit 1b5bf2c848

View File

@@ -116,12 +116,7 @@ const char *get_disconnect_reason_str(uint8_t reason) {
}
WiFiSTAConnectStatus WiFiComponent::wifi_sta_connect_status_() const {
// Use cyw43_wifi_link_status instead of cyw43_tcpip_link_status because the Arduino
// framework's __wrap_cyw43_cb_tcpip_init is a no-op — the SDK's internal netif
// (cyw43_state.netif[]) is never initialized. cyw43_tcpip_link_status checks that netif's
// flags and would only fall through to cyw43_wifi_link_status when the flags aren't set.
// Using cyw43_wifi_link_status directly gives us the actual WiFi radio join state.
int status = cyw43_wifi_link_status(&cyw43_state, CYW43_ITF_STA);
int status = cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_STA);
switch (status) {
case CYW43_LINK_JOIN:
case CYW43_LINK_NOIP: