Skip to content
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

Fixed issue where esp32 won't reconnect to WiFi AP if the AP was restarted. #7512

Merged
merged 7 commits into from
Dec 22, 2022

Conversation

sanketwadekar
Copy link
Contributor

@sanketwadekar sanketwadekar commented Nov 25, 2022


Description of Change

In the WiFi Provisioning example, the esp32 won't reconnect to the AP if the AP lost power and was restarted at some later point.

Tests scenarios

I have tested this using WiFiProv example on ESP32.
I connected the ESP32 to Mobile Hotspot and turned the Hotspot OFF/ON multiple times.

Related links

Closes espressif/esp-rainmaker#194

Co-authored-by: Pedro Minatel pedro.minatel@espressif.com

@VojtechBartoska VojtechBartoska added Area: BT&Wifi BT & Wifi related issues Type: Example Issue is related to specific example. labels Nov 25, 2022
@P-R-O-C-H-Y
Copy link
Member

P-R-O-C-H-Y commented Nov 30, 2022

Hi @sanketwadekar I have retest this issue and when I turn Hotspot on my phone OFF, the reason for disconnecting is Reason: 3 - AUTH_LEAVE, so when I turn the Hotspot ON again, ESP32 automatically reconnects.

@sanketwadekar
Copy link
Contributor Author

Hi @sanketwadekar I have retest this issue and when I turn Hotspot on my phone OFF, the reason for disconnecting is Reason: 3 - AUTH_LEAVE, so when I turn the Hotspot ON again, ESP32 automatically reconnects.

Some users(Rainmaker) have reported that their device won't reconnect and the reason in their case was UNSPECIFIED, and I too was able to reproduce this. Would keeping this change cause issues for other users?

@P-R-O-C-H-Y
Copy link
Member

P-R-O-C-H-Y commented Nov 30, 2022

Some users(Rainmaker) have reported that their device won't reconnect and the reason in their case was UNSPECIFIED, and I too was able to reproduce this. Would keeping this change cause issues for other users?

I will discuss it with colleagues. I am not sure, if there can be any other reasons marked as "UNSPECIFIED", where we should not do auto-reconnect.

@VojtechBartoska
Copy link
Collaborator

@me-no-dev and @pedrominatel we have discussed this PR a bit during today's meeting and we were not sure about proposed fix. Can you please help with review? Thanks.

@VojtechBartoska VojtechBartoska removed the request for review from PilnyTomas November 30, 2022 13:37
@pedrominatel
Copy link
Member

Adding the WIFI_REASON_UNSPECIFIED to the isReconnectableReason could fix but I think the WIFI_REASON_UNSPECIFIED could be generic and cause some unexpected reconnection attempt when reconnecting is not necessary.

This fix could be acceptable but more investigation can be done to be sure that this fix will work in most cases.

Is there any other reason that could be considered to be a reconnectable reason in the wifi_err_reason_t?

@pedrominatel
Copy link
Member

Hi guys,

I've changed the approach to the ESP-IDF recommendation.

PTAL @sanketwadekar and @me-no-dev at my proposal.

Now the reconnection should be done always except if the disconnection was done by the user.

@pedrominatel pedrominatel added Status: In Progress Issue is in progress and removed Status: Pending labels Dec 15, 2022
@me-no-dev me-no-dev merged commit 7c79cdd into espressif:master Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: BT&Wifi BT & Wifi related issues Status: In Progress Issue is in progress Type: Example Issue is related to specific example.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wifi Reconnect Issue (MEGH-3995)
5 participants