- Wed Nov 01, 2017 7:10 pm
#71461
The autoconnect behavior is useful, and considered by many to be a feature. But it can be confusing and cause unexpected behavior when you are tinkering with lots of different things, using the same ESP8266.
Here's something I did a while back to get around this, put these in Setup():
// these eliminate the chance of 'already connected' failure in WiFi.begin()
WiFi.persistent(false);
// only needed once, SDK saves it somewhere
if (WiFi.getAutoConnect()) WiFi.setAutoConnect(false);
WiFi.persistent(false) disables WiFI.begin() from saving the mode and credentials. WiFi.setAutoConnect(false) disables the autoconnect (in case there are already some saved WiFi settings.)
Looking at it now, I realize I don’t know what effect it has, if any, on 8266 coming up as AP when not explicitly starting WiFi...