Now i have added a new Wemos moduel and it does not load the credentials from eeprom:
It should try from EEPROM else use the Sketch's credentials, else use smart config.
it connects on the sketch's credentials, but shouldn't it connect from EEPROM next time?
do I miss a code to wirtie the credentials to EEPROM?
Thank you for helping.
Here is my code:
void getWiFi() // From Memory , Using Defaults, or using SmartConfig
{
int retry = 0;
WiFi.mode(WIFI_STA); // configure WiFi in Station Mode
wifi_station_set_auto_connect(true);
wifi_station_set_hostname(HOST_NAME);
delay(wifiRepeatInterval);
Console3.println("Attempt to connect to WiFi network from EEPROM");
WiFi.begin();
delay(wifiRepeatInterval);
while (WiFi.status() != WL_CONNECTED)
{
Console3.print(".");
digitalWrite(STDLED, not digitalRead(STDLED));
delay(wifiRepeatInterval) ;
if (retry++ >= wifiMaxTries) break;
}
if (WiFi.status() != WL_CONNECTED)
{
Console3.println("\nConnection timeout expired! Start with default");
retry = 0;
WiFi.begin(WIFI_SSID, WIFI_PASS);
delay(wifiRepeatInterval * 2 );
while (WiFi.status() != WL_CONNECTED)
{
Console3.print(".");
digitalWrite(STDLED, not digitalRead(STDLED));
delay(wifiRepeatInterval);
if (retry++ >= wifiMaxTries) break;
}
}
if (WiFi.status() != WL_CONNECTED)
{
Console3.println("Connection timeout expired! Start SmartConfig…");
retry = 0;
WiFi.beginSmartConfig();
digitalWrite(STDLED, false);
while (WiFi.status() != WL_CONNECTED)
{
Console3.print(".");
digitalWrite(STDLED, not digitalRead(STDLED));
delay(wifiRepeatInterval * 4);
if (retry++ >= wifiMaxTries) break;
if (WiFi.smartConfigDone())
{
Console3.println("SmartConfig success!");
break; // exit from loop
}
}
}