Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By NekBoy
#49843 Such a long time since this post but I am definately not getting my ESP8266 12E dev module to retain WiFi credentials. It would be awsome if it did. I have some code that extracts ssid and password from files on a sd card. once i get logon, if i remove the sd card there is no retained memory of last successful logon. I've tried code submitted by draco on post #14829 to search the eeprom, and all i get is garbled rubbish at the two addresses he identified a sbeing where the wifi credentials live.

schufti wrote:Hi,
just a little sidenote on the storage part:

it is not necessary to store the WiFi credentials. If you do a "WiFi.begin(ssid, pass)" with valid credentials and get connected, the esp fw stores them internal. The next time you can use "WiFi.begin("","")" and the esp fw will use the "last known good" credentials. If several attempts to (re)connect fail (or e.g. button is pressed at startup), it is time to fire up the config again.

Not a lot to spare but even simpler....
User avatar
By acpilot
#49891 Great library and this thread has been useful.

However, how does one modify the library. I too have problems with the "+" inserted into spaces in my SSID. How do I edit the library to copy your fix?

Also, how difficult would it be for the author to modify this as an update? <not that he has to...already a great tutorial! Just sayin'...>

luketanti wrote:Hi all. First of all thanks for this great library.

I have been trying to connect to my AP which the SSID contains spaces.
But instead of spaces it saved a plus sign '+' instead. This made it impossible for the ESP to connect to my AP.

In the library I have modified a little the setEEPROMString method.

Code: Select allvoid WiFiManager::setEEPROMString(int start, int len, String string) {
    int si = 0;
    for (int i = _eepromStart + start; i < _eepromStart + start + len; i++) {
        char c;
        if(si < string.length()) {
            c = string[si];
         if (c == '+')
            c = ' ';
            DEBUG_PRINT("Wrote: ");
            DEBUG_PRINT(c);
           
        } else {
            c = 0;
        }
        EEPROM.write(i, c);
        si++;
    }
   
}


All I have done is to replace any '+' characters with a space ' ' character.

It worked fine after this modification.
Hope this helps someone :D
User avatar
By scargill
#51300 Just need some clarification here - the ESP8266 doesn't have any EEPROM... so this must be using FLASH - as the flash writes in 4K blocks - is this writing 4k for every single byte or is there some kind of delayed buffering going on?


chriscook8 wrote:https://github.com/chriscook8/esp-arduino-apboot

This reads from eeprom to get SSID and password information. Then trys to connect to it. If it doesn't work, or no SSID is found it boots into a AP mode hosting a configuration webpage.

First pass on this task anyway.

Chris