Right now I am starting up my esp32-c3 in APSTA mode using esp-idf. This serves a captive portal where a user can select a wifi network and connect to it, similar to how tasmota and wifimanager work. I am able to connect to a network if I call esp_wifi_stop();, then reconfigure, then start the network, but this closes the captive portal. I am would like to start in APSTA mode, but only configure the AP part, then configure the STA later, confirm the STA is working, then shut down the AP, all without rebooting or shutting off wifi or loosing AP connection.
Is this possible and if so how would I do it?
How to connect to wifi network while in APSTA mode?
-
- Posts: 3
- Joined: Wed Feb 23, 2022 11:48 pm
Re: How to connect to wifi network while in APSTA mode?
I am doing something similar (captive portal for Wi-Fi provisioning) in my project and I'd also like an answer to this question.
When operating in APSTA mode, I want to be able to bring up or shut down the AP without affecting the STA connection status, or connect/disconnect the STA without affecting AP operation.
Is this possible?
When operating in APSTA mode, I want to be able to bring up or shut down the AP without affecting the STA connection status, or connect/disconnect the STA without affecting AP operation.
Is this possible?
Re: How to connect to wifi network while in APSTA mode?
This is still relevant. Is it possible?
Re: How to connect to wifi network while in APSTA mode?
Yes, you can freely change WiFi mode without needing to completely stop and restart the driver.
eg.
eg.
Code: Select all
esp_wifi_start();
esp_wifi_set_mode(AP);
esp_wifi_set_config(AP, &ap_config);
/* ... Receive WiFi credentials from user ... */
esp_wifi_set_mode(APSTA);
esp_wifi_set_config(STA, &user_sta_config);
esp_wifi_connect();
/* ... Connection succeeded, we decide we don't need AP any more ... */
esp_wifi_set_mode(STA);
/* ... Do things, then when done ... */
esp_wifi_disconnect();
esp_wifi_stop();
Re: How to connect to wifi network while in APSTA mode?
Hi, any one from this post has a good source code about this?
I am also trying to make something "similar" to wifimanager but in esp-idf framework.
Thanks a lot
I am also trying to make something "similar" to wifimanager but in esp-idf framework.
Thanks a lot
Who is online
Users browsing this forum: Baidu [Spider], MicroController and 71 guests