WiFi + Provision working simultaneously

daviherc
Posts: 4
Joined: Wed Apr 28, 2021 5:31 pm

WiFi + Provision working simultaneously

Postby daviherc » Wed Apr 28, 2021 5:35 pm

Hello all,

I'd like my ESP32 to be open to new network configurations while connected to the internet. My situation is that the ESP32 should sometimes switch from one WiFi network to another through user input.

Currently, I can set the ESP32 to connect to the first network through the WiFi Provisioning Manager, but if I reactivate the provisioning manager the internet connection breaks. Is there any way around this?

ESP_YJM
Posts: 48
Joined: Fri Feb 26, 2021 10:30 am

Re: WiFi + Provision working simultaneously

Postby ESP_YJM » Thu Apr 29, 2021 10:16 am

You can remove esp_wifi_disconnect() in function wifi_prov_mgr_start_provisioning() and add esp_wifi_disconnect() in function wifi_connect_timer_cb(),before the esp_wifi_connect().

daviherc
Posts: 4
Joined: Wed Apr 28, 2021 5:31 pm

Re: WiFi + Provision working simultaneously

Postby daviherc » Sun May 02, 2021 10:45 pm

Thank you, worked perfectly.

I did not use the second change so I could decouple the connection action from the provision action, so I called the connect function elsewhere.

ESP_YJM
Posts: 48
Joined: Fri Feb 26, 2021 10:30 am

Re: WiFi + Provision working simultaneously

Postby ESP_YJM » Thu May 06, 2021 2:40 am

In short, remember that if the wifi is already connected, calling esp_wifi_connect() will not reconnect.

daviherc
Posts: 4
Joined: Wed Apr 28, 2021 5:31 pm

Re: WiFi + Provision working simultaneously

Postby daviherc » Tue Aug 10, 2021 1:31 pm

Hello again,

I wanted to perform a similar procedure with the ESP32: I want the ESP32 to be open to new provisionings while it is trying to connect, to allow the user to change networks if the current is unstable.

I tried to use those changes mentioned above, but I keep getting the errors:

GAP procedure initiated: advertise; disc_mode=2 adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=256 adv_itvl_max=256
E (2866) wifi:sta is connecting, return error
- "ESP_ERR_WIFI_CONN"
- "ESP_ERR_WIFI_SSID"

I am calling:

wifi_prov_mgr_start_provisioning(WIFI_PROV_SECURITY_1, pop_, service_name_, NULL);
esp_wifi_connect();

Would there be any workarounds to that? Should I implement my own provisioning method?

Thank you!

ESP_YJM
Posts: 48
Joined: Fri Feb 26, 2021 10:30 am

Re: WiFi + Provision working simultaneously

Postby ESP_YJM » Wed Sep 15, 2021 7:42 am

It seems the WIFI is connecting. Before you call esp_wifi_connect(), you can call esp_wifi_disconnect() first.

Return to “ESP-IDF”

Who is online

Users browsing this forum: No registered users and 46 guests