Description
the code below works perfectly in 2.7.4 version of the esp8266 board, but in 3.0.2 it does not connect and goes to smartconfig everytime..
void wifiSetup() {
/* Set ESP8266 to WiFi Station mode /
WiFi.mode(WIFI_STA);
int cnt = 0; bool smartcfg = false;
/ Wait for WiFi to connect to AP /
Serial.println("Waiting for WiFi");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
if((cnt++ >= 40) && !smartcfg) {
/ start SmartConfig /
int scnt = 0;
WiFi.beginSmartConfig();
/ Wait for SmartConfig packet from mobile */
Serial.println("Waiting for SmartConfig.");
while (!WiFi.smartConfigDone()) {
delay(500);
Serial.print(":");
if(scnt++ >= 120) ESP.reset();
}
Serial.println("");
Serial.println("SmartConfig done.");
smartcfg = true;
}
}
Serial.println("WIFI CONNECTED");
Serial.print("IP Address: ");
Serial.println(WiFi.localIP());
}