Disconnect and reconnect ESP32 to hotspot.

filipESP
Posts: 71
Joined: Tue Nov 06, 2018 12:42 pm

Disconnect and reconnect ESP32 to hotspot.

Postby filipESP » Tue Jan 15, 2019 5:37 pm

Hi.
I want to disconnect wifi when it is idle for long time and reconnect when I set any GPIO to high level.
Reconnect work when I put esp_connect_wifi into event_handler in SYSTEM_EVENT_STA_DISCONNECTED case, but doesn't work when I call esp_connect_wifi in other function.
How to make it working?

filipESP
Posts: 71
Joined: Tue Nov 06, 2018 12:42 pm

Re: Disconnect and reconnect ESP32 to hotspot.

Postby filipESP » Wed Jan 16, 2019 12:53 pm

I resolved my issue by using esp_wifi_stop() and esp_wifi_start().
I also used the flag to notify the event_handler that it can call esp_wifi_connect ( in SYSTEM_EVENT_STA_DISCONNECTED case ) when I will want to connect to Hotspot.

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Disconnect and reconnect ESP32 to hotspot.

Postby Ritesh » Wed Jan 16, 2019 5:09 pm

So, is there any issue now to reconnect with hot-spot?
Regards,
Ritesh Prajapati

filipESP
Posts: 71
Joined: Tue Nov 06, 2018 12:42 pm

Re: Disconnect and reconnect ESP32 to hotspot.

Postby filipESP » Wed Jan 16, 2019 6:02 pm

It's done. :)

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Disconnect and reconnect ESP32 to hotspot.

Postby Ritesh » Thu Jan 17, 2019 8:02 am

filipESP wrote:
Wed Jan 16, 2019 6:02 pm
It's done. :)
Great. Good Job. Let me know if any issue into future for ESP32
Regards,
Ritesh Prajapati

Who is online

Users browsing this forum: No registered users and 110 guests