I found the issue noticed by many that some random number of ESP devices don't connect well to dual band routers. Looping through Wifi.begin() seems to help significantly. I made this code change in two places inside of WiFI Provisioner and have not had a problem since. Moving the Wifi.begin inside of the While not connected loop, before the delay, and timeout check. Save for ConnectToWiFi and connectToExistingWiFINetwork functions.
while (WiFi.status() != WL_CONNECTED) {
if (storedPassword.isEmpty()) {
WiFi.begin(storedSSID.c_str());
} else {
WiFi.begin(storedSSID.c_str(), storedPassword.c_str());
}
delay(wifiDelay);
// Check if the connection timeout is reached
if (connectionTimeout != 0 &&
millis() >= startTime) {
WiFi.disconnect();
delay(wifiDelay);
debugPrintln(
"Connection timeout reached, continuing to start the provision");
return false;
}
}
Thank you for the feedback, i can take a look at it to add it to the next release. Also if you're interested, you're welcome to submit a pull request with your proposed changes.
I found the issue noticed by many that some random number of ESP devices don't connect well to dual band routers. Looping through Wifi.begin() seems to help significantly. I made this code change in two places inside of WiFI Provisioner and have not had a problem since. Moving the Wifi.begin inside of the While not connected loop, before the delay, and timeout check. Save for ConnectToWiFi and connectToExistingWiFINetwork functions.
while (WiFi.status() != WL_CONNECTED) { if (storedPassword.isEmpty()) { WiFi.begin(storedSSID.c_str()); } else { WiFi.begin(storedSSID.c_str(), storedPassword.c_str()); }
delay(wifiDelay); // Check if the connection timeout is reached if (connectionTimeout != 0 && millis() >= startTime) { WiFi.disconnect(); delay(wifiDelay); debugPrintln( "Connection timeout reached, continuing to start the provision"); return false; } }