You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WIFI.isconnected stil false after router reboot but ping requests reponse etc works #4210
changed the title [-]WIFI.isconnected stil false after router reboot but ping requests reponse etc [/-][+]WIFI.isconnected stil false after router reboot but ping requests reponse etc works[/+]on Jan 21, 2018
I am also looking for a proper solution here. If I forcefully disconnect my device from my router, it reconnects but the status is continuously reported as WL_DISCONNECTED.
As a workaround you can call WiFi.disconnect(true); to disable wifi and then reconnect.
I have the same problem. I expected, that function WiFi.isConnected() should return true and WiFi.status() should return WL_CONNECTED code after automatic reconnection to Wi-Fi AP, however for some reason these functions return false and WL_DISCONNECTED respectively. But in fact, ESP has connected to Wi-Fi AP successfully.
@d-a-v I hurried with conclusions, when said that WiFi.status() works properly. Today I've faced this problem again. If I set AutoReconnect to false and when I turned off my Wi-Fi Access Point, WiFi.isConnected() return incorrect status WL_CONNECTED. If AutoReconnect is true (comment out this string WiFi.setAutoReconnect(false);), then WiFi.isConnected() will return correct status WL_DISCONNECTED after turning off Wi-Fi router. But WiFi.status() return different statuses with different Wi-Fi routers (see serial monitor outputs below).
And second bug, which I encountered, function WiFi.setAutoConnect(false); doesn't set AutoConnect to false, if persistent is false: WiFi.persistent(false);. See example sketch below, compiled by Arduino IDE v. 1.8.5:
@RAlexeev lwip2 is meant to follow lwip1.4 behavior regarding link layer connection status.
To help narrowing the source of this issue, can you please verify whether same things happen when using lwip1.4 ?
I remember that some time ago I didnt have these problems. And now it seems to me that it happened after erasing flash: Sketch + WiFi Settings. If I select this errasing option, then function setAutoConnect doesn't set AutoConnect to false. But it set AutoConnect to false, if I add this string WiFi.mode(mode); to my sketch before setAutoConnect.
Thanks for the report,
Should it be mentioned in the documentation to use WiFi.setAutoConnect() (or is it only WiFi.getAutoConnect()?) after WiFi.mode(WIFI_AP_STA) or WiFi.mode(WIFI_STA) ?.
WiFi.setAutoConnect(false); works for me only after WiFi.mode(WIFI_STA); or WiFi.mode(WIFI_AP_STA);. But WiFi.mode(WIFI_OFF); and WiFi.mode(WIFI_AP); doesn't affect for WiFi.setAutoConnect(false); and AutoConnect is true after that. Even more, if I set WiFi.setAutoConnect(false); after WiFi.mode(WIFI_AP_STA); or WiFi.mode(WIFI_AP); and then restart ESP8266, Access Point will be created anyway. And that seems strange, AP's SSID will be empty after WiFi.softAPdisconnect();, not even default value after module restart. Is there way to turn off softAP auto creation? Especially empty SSID is annoying.
As I understand, WiFi.softAPdisconnect(true) switches the soft-AP mode off, but not affects SSID/password stored in flash, because persistent is false. But after restart ESP I see network with default SSID (in my case it's ESP_181458) instead of my custom name "My_ESP".
Activity
[-]WIFI.isconnected stil false after router reboot but ping requests reponse etc [/-][+]WIFI.isconnected stil false after router reboot but ping requests reponse etc works[/+]bugadani commentedon Feb 14, 2018
I am also looking for a proper solution here. If I forcefully disconnect my device from my router, it reconnects but the status is continuously reported as WL_DISCONNECTED.
As a workaround you can call
WiFi.disconnect(true);to disable wifi and then reconnect.RAlexeev commentedon Jun 27, 2018
I have the same problem. I expected, that function
WiFi.isConnected()should returntrueandWiFi.status()should returnWL_CONNECTEDcode after automatic reconnection to Wi-Fi AP, however for some reason these functions returnfalseandWL_DISCONNECTEDrespectively. But in fact, ESP has connected to Wi-Fi AP successfully.I compile my sketch by Arduino IDE v. 1.8.5:
Serial monitor output:
d-a-v commentedon Jun 27, 2018
@d00lar @bugadani @RAlexeev Please try latest master. Yesterday's fixes were about WiFi disconnection and reconnection.
RAlexeev commentedon Jun 27, 2018
Library from master branch seems really works properly in this place! Thank you!
RAlexeev commentedon Jun 30, 2018
@d-a-v I hurried with conclusions, when said that
WiFi.status()works properly. Today I've faced this problem again. If I set AutoReconnect to false and when I turned off my Wi-Fi Access Point,WiFi.isConnected()return incorrect statusWL_CONNECTED. IfAutoReconnectis true (comment out this stringWiFi.setAutoReconnect(false);), thenWiFi.isConnected()will return correct statusWL_DISCONNECTEDafter turning off Wi-Fi router. ButWiFi.status()return different statuses with different Wi-Fi routers (see serial monitor outputs below).I compile my sketch by Arduino IDE v. 1.8.5:
I've tried run this sketch with Wi-Fi Access Point, created by Android smartphone.
Serial monitor output, when
AutoReconnectisfalse:Serial monitor output, when
AutoReconnectistrue:I've tried run this sketch with other Wi-Fi router (D-Link DIR-860L).
Serial monitor output, when
AutoReconnectisfalse:Serial monitor output, when
AutoReconnectistrue:RAlexeev commentedon Jun 30, 2018
And second bug, which I encountered, function
WiFi.setAutoConnect(false);doesn't setAutoConnecttofalse, ifpersistentisfalse:WiFi.persistent(false);. See example sketch below, compiled by Arduino IDE v. 1.8.5:Serial monitor output:
UPD: Now
WiFi.setAutoConnectdoesn't setAutoConnecttofalseeven whenpersistentistrue.d-a-v commentedon Jul 2, 2018
@RAlexeev lwip2 is meant to follow lwip1.4 behavior regarding link layer connection status.
To help narrowing the source of this issue, can you please verify whether same things happen when using lwip1.4 ?
RAlexeev commentedon Jul 2, 2018
Using
lwip1.4doesn't solve this problem. I shortened my sketch for clarity:Serial monitor output for lwip2:
Serial monitor output for lwip1.4:
d-a-v commentedon Jul 2, 2018
Thanks !
I can't reproduce.
Have you tried the
Tools>Erase Flash>All Flash Contentsoption ?RAlexeev commentedon Jul 2, 2018
I remember that some time ago I didnt have these problems. And now it seems to me that it happened after erasing flash: Sketch + WiFi Settings. If I select this errasing option, then function
setAutoConnectdoesn't setAutoConnecttofalse. But it setAutoConnecttofalse, if I add this stringWiFi.mode(mode);to my sketch beforesetAutoConnect.If I upload this sketch, erasing only sketch, then
setAutoConnectworks fine without additional stringWiFi.mode(mode);.d-a-v commentedon Jul 2, 2018
Thanks for the report,
Should it be mentioned in the documentation to use
WiFi.setAutoConnect()(or is it onlyWiFi.getAutoConnect()?) afterWiFi.mode(WIFI_AP_STA)orWiFi.mode(WIFI_STA)?.RAlexeev commentedon Jul 2, 2018
Thank you!
WiFi.setAutoConnect(false);works for me only afterWiFi.mode(WIFI_STA);orWiFi.mode(WIFI_AP_STA);. ButWiFi.mode(WIFI_OFF);andWiFi.mode(WIFI_AP);doesn't affect forWiFi.setAutoConnect(false);and AutoConnect istrueafter that. Even more, if I setWiFi.setAutoConnect(false);afterWiFi.mode(WIFI_AP_STA);orWiFi.mode(WIFI_AP);and then restart ESP8266, Access Point will be created anyway. And that seems strange, AP's SSID will be empty afterWiFi.softAPdisconnect();, not even default value after module restart. Is there way to turn off softAP auto creation? Especially empty SSID is annoying.My sketch:
First execution after firmware uploading:
Second execution (only restart without firmware uploading):
RAlexeev commentedon Jul 3, 2018
As I understand,
WiFi.softAPdisconnect(true)switches the soft-AP mode off, but not affects SSID/password stored in flash, becausepersistentisfalse. But after restart ESP I see network with default SSID (in my case it's ESP_181458) instead of my custom name "My_ESP".Serial monitor output:
Restart ESP
Sometimes I see these three networks at the same time:
May be you could give me a clue how to disable default SoftAP at start.
d-a-v commentedon Mar 31, 2021
Closing as duplicate #7432, let's follow-up there !