-->
Page 1 of 1

WiFi AP turns off when calling WiFi.begin

PostPosted: Mon Jul 17, 2017 7:43 am
by BlazU
Hello,
I have an ESP8266 configured as an access point, which further exposes a web server. On the exposed web page, the user can enter the SSID and password of the target WiFi, which will then be used to send data. I need to test the target WiFi connectivity and then reply a summary page. To test the target WiFi, I call WiFi.begin(SSID, pass), but when I do this, the current access point closes and the summary page cannot be returned.

Some snippets:

SETUP:
//create AP
WiFi->softAPConfig(ipAddress, ipAddress, IPAddress(255, 255, 255, 0));
WiFi->softAP(ssid, password);

//create web server
_webServer = ESP8266WebServer(80);
_webServer.begin();
_webServer.on("/", provisioningModeLogic);


PROVISIONINGMODELOGIC (HANDLECLIENT):
//get data from web page
_webServer.arg("ssid").c_str();
_webServer.arg("password").c_str();

//test for wifi connectivity
bool wiFiConnectionOK = false;
_WiFi.begin(ssid, password); //ACCESS POINT DISCONNECTS HERE!
if (_WiFi.status() == WL_CONNECTED)
{
wiFiConnectionOK = true;
}

//return summary page
_webServer.send(200, "text/html", summaryHTMLString);

Is this a bug or am I doing something wrong? The ESP8266 should be able to work as AP and STA simultaneously.

Thanky and kind regards,
Blaz