-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WiFi fails to reconnect after AP reappears (IDFGH-1412) #738
Comments
i should add that this used to work way back when, i remember the device deifnitely reconnected to AP after it reappeared. i had to add this explicit |
@rojer We have fixed a few bugs about WiFi connection recently. Please use the latest IDF to check if this problem still exist. Thanks. |
The 201 phenomenon, as far as my observations go, is independent of an AP disappearing. It happens also when the ESP32 disconnects and tries to reconnect. In my case, it's not an infinite loop though, but I fall back to stopping and restarting WiFi. It takes a number of times until the connect will work. Try the latest IDF update; in my case it seems to have improved things a little bit, but it's under observation. @TimXia Thank you for bringing the update to our attention. |
@TimXia still the same on latest master (90f1d42). @HubbyGitter right, i don't stop and restart wifi, just keep calling |
found a workaround: if you call |
@rojer could you plz provide you AP model? |
@heyinling it's a Nexus 5X android phone, portable hotspot AP. but that's not the reason anyway. see above: the reason is that |
I see. I also call Is your reproduce step as follow:
It would also be helpful if you can help provide Android version of your phone. we'll try to reproduce this bug. |
espressif/esp-idf#738 PUBLISHED_FROM=bee2695a9b9a3a24b9eb265454abf038801d1281
@heyinling that's exactly what i did. no, ESP32 does not reconnect after AP comes back - as long as you can see my workaround in the commit above. this fixes the problem. |
ok, i got to the bottom of the issue.
about this potential pitfall. or just remove it altogether and force users to handle events on the system handler. |
Good for you. I reconnect from my stat machine task, not from any other context. Actually, I make all wifi API calls from a single task which is "mine". Still, it takes several 201s before the connect succeeds. But we have a different thread for that. |
@rojer To clarify, you set your own eventhandler function? and now you use the system event handler set with esp_event_loop_init? |
@Resultfactory yes, i used to set |
@rojer - Is it possible to post your code? I'm having a very similiar issue with WiFi.reconnect not working and I also am calling it from the STA_DISCONNECT. |
I believe ESP works only on 2.4G networks.. so if your network is 5G.. try connecting to 2.4g network ssid |
* Add access to last write date time add example * rename cpp to ino orz * wrong copy -past * No comment orz * Add missing space
This seems so blindingly obvious, that I seriously doubt it's a bug, maybe API usage issue, but anyway.
ESP32 fails to reconnect to AP after it goes away and comes back.
My code invoked
wifi_connect()
immediately on gettingSYSTEM_EVENT_STA_DISCONNECTED
(for any reason), but it just sits there, in a reason 201 loop:so far so good. now i turn off the AP:
when i turn the AP back on, there's no reaction from the ESP, it just keeps looping, no new wifi messages appear.
so, the question is: is calling
wifi_connect()
the right thing to do if i want station to stay connected with the same configuration?The text was updated successfully, but these errors were encountered: