Closed
Description
Bug Description
- The Terminal output shows that even after WiFi was powered down,
WiFi.status()
still reportsWL_CONNECTED
arduino-pico/libraries/WiFi/src/WiFiClass.cpp
Lines 472 to 484 in 5787b4c
- The RSSI is always shows
0 dBm
, even WiFi is connected
arduino-pico/libraries/WiFi/src/WiFiClass.cpp
Lines 320 to 323 in 5787b4c
This bug is very similar to [Portenta_H7] WiFi.status() wrongly reports WL_CONNECTED even when WiFi is lost #381
MRE
Using the following sketch
Arduino IDE v1.8.19,
arduino-pico core v2.4.0
RASPBERRY_PI_PICO_W using CYW43439 WiFi
#include <WiFi.h>
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
char ssid[] = "YOUR_SSID"; // your network SSID (name)
char pass[] = "YOUR_PASSWORD"; // your network password (use for WPA, or use as key for WEP)
int status = WL_IDLE_STATUS;
void printWifiStatus()
{
// print the SSID of the network you're attached to:
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
// print your board's IP address:
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
// print the received signal strength:
long rssi = WiFi.RSSI();
Serial.print("signal strength (RSSI):");
Serial.print(rssi);
Serial.println(" dBm");
}
void setup()
{
//Initialize serial and wait for port to open:
Serial.begin(115200);
while (!Serial && millis() < 5000);
Serial.print(F("\nStarting RP2040W_WiFi_Bug on ")); Serial.println(BOARD_NAME);
// check for the WiFi module:
if (WiFi.status() == WL_NO_SHIELD)
{
Serial.println("Communication with WiFi module failed!");
// don't continue
while (true);
}
// attempt to connect to Wifi network:
while (status != WL_CONNECTED)
{
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
status = WiFi.begin(ssid, pass);
// wait 3 seconds for connection:
delay(3000);
}
}
void loop()
{
if (WiFi.status() == WL_CONNECTED)
{
Serial.println("Connected to wifi");
printWifiStatus();
}
else
{
Serial.println("Not connected to wifi");
}
delay(5000);
}
Terminal output
Starting RP2040W_WiFi_Bug on RASPBERRY_PI_PICO_W
Attempting to connect to SSID: HueNet1
Attempting to connect to SSID: HueNet1
Connected to wifi
SSID: HueNet1
IP Address: 192.168.2.180
signal strength (RSSI):0 dBm <======== RSSI = 0 dBm when connected
Connected to wifi
SSID: HueNet1
IP Address: 192.168.2.180
signal strength (RSSI):0 dBm
... <============ Power down WiFi, WiFi.status() is still WL_CONNECTED
Connected to wifi
SSID: HueNet1
IP Address: 192.168.2.180
signal strength (RSSI):0 dBm
Connected to wifi
SSID: HueNet1
IP Address: 192.168.2.180
signal strength (RSSI):0 dBm
Connected to wifi
SSID: HueNet1
IP Address: 192.168.2.180
signal strength (RSSI):0 dBm
Connected to wifi
SSID: HueNet1
IP Address: 192.168.2.180
signal strength (RSSI):0 dBm
Metadata
Metadata
Assignees
Labels
No labels