Page 1 of 1

Can I use STA and AP at the same time ?

Posted: Mon Oct 28, 2019 10:57 am
by GeorgeFlorian1
Hello !

TL;DR: How can I have AP and STA at the same time, configuring SSID, Password and/or IP Address, Gateway, SubnetMask, DNS while also serving pages using ESPAsyncWebServer to the user giving it the possibility of configuring the previously mentioned parameters and much more.

Right now, my code is separated into two blocks: AP and STA.

While in AP, I give the end-user the possibility of configuring SSID, Password and/or IP Address, Gateway, SubnetMask, DNS.

After the values were entered and saved, the ESP restarts and tries a WiFi.begin(SSID, Password); followed by WiFi.config();

And in STA I have the "functional" code, depending on the project at hand.

I would like to eliminate the ESP.restart() that separates the two WiFi modes and the transition time from one mode to the other. I would like to offer the user a smooth experience while setting up the ESP32.

Re: Can I use STA and AP at the same time ?

Posted: Mon Oct 28, 2019 2:19 pm
by zekageri
You can just use WiFi.mode(WIFI_AP_STA); and than WiFi.begin(SSID,PASSWORD); after the user set it on AP.
Or if it is not working like this, use the WiFi.disconnect() from AP mode and then set AP_STA and start wifi.
If the user configured the right credentials , i assume that they want to switch to the sta network anyway.

Re: Can I use STA and AP at the same time ?

Posted: Tue Oct 29, 2019 2:00 pm
by GeorgeFlorian1
zekageri wrote:
Mon Oct 28, 2019 2:19 pm
You can just use WiFi.mode(WIFI_AP_STA); and than WiFi.begin(SSID,PASSWORD); after the user set it on AP.
Or if it is not working like this, use the WiFi.disconnect() from AP mode and then set AP_STA and start wifi.
If the user configured the right credentials , i assume that they want to switch to the sta network anyway.
How would that look like ?