Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By gmc
#71419 I've got a NodeMCU and the have a odd problem where the ESP always seems to be running in AP mode. On my phone if I run Wifi analyser I can see the AP with a SSID of ESP_xxxx and there is no security setup on it.

Even if I upload the standard blink code, the device blinks and ESP_xxxx is visible again.

I've tried wiping the flash with esptool erase_flash. After I upload blink code, or any other code (With or without wifi configured) the flaming ESP is in AP mode.

What gives? Losing my mind on this.
User avatar
By QuickFix
#71422 Since the WiFi stack runs in a separate thread, you have to set its mode in code.

In Arduino, you can do this with WiFi.mode(x), where x can be WIFI_AP, WIFI_STA, WIFI_AP_STA or WIFI_OFF, for example:
Code: Select allWiFi.mode(WIFI_STA);
will set the ESP into client ("Station") mode.

When the current firmware is the default AT-firmware, you have to set the mode with the AT+CWMODE command, for instance:
Code: Select allAT+CWMODE=1
will put the ESP into client ("Station") mode.
User avatar
By gmc
#71436 That did the trick, Thanks very much. I have a few of these devices and this was the only one doing this so must have been enabled at the factory.
User avatar
By tele_player
#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...