Closed
Description
Basic Infos
- This issue complies with the [issue POLICY doc]
- I have read the documentation at readthedocs and the issue is not addressed there.
- I have tested that the issue is present in current master branch (aka latest git).
- I have searched the issue tracker for a similar issue.
- If there is a stack dump, I have decoded it.
- I have filled out all fields below.
Platform
- Hardware: NodeMCU V0.9
- Core Version: latest, might be 68f04bc
- Development Env: Arduino IDE
- Operating System: Windows
Settings in IDE
- Module: Nodemcu 0.9
- Flash Mode: ?
- Flash Size: 4MB
- lwip Variant: v2 Lower Memory
- Reset Method: nodemcu
- Flash Frequency: 40Mhz
- CPU Frequency: 80Mhz
- Upload Using: SERIAL
- Upload Speed: 256000
Problem Description
Adding WiFi.setSleepMode(WIFI_LIGHT_SLEEP); to Setup() "crashes" Loop() in a way. Loop() stops running, or perhaps Delay never returns. Tested the same sketch against 2.4.0 and it runs fine. Never "dies".
MCVE Sketch
#include <ESP8266WiFi.h>
const char* ssid = "OpenWrt3";
const char* password = "";
void setup() {
Serial.begin(115200);
WiFi.setSleepMode(WIFI_LIGHT_SLEEP);
delay(10);
// We start by connecting to a WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
/* Explicitly set the ESP8266 to be a WiFi-client, otherwise, it by default,
would try to act as both a client and an access-point and could cause
network-issues with your other WiFi-devices on your WiFi-network. */
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
int value = 0;
void loop() {
delay(1000);
Serial.println("Delay");
}
Debug Messages
SDK:2.2.1(cfd48f3)/Core:win-2.5.0-dev/lwIP:2.0.3(STABLE-2_0_3_RELEASE/glue:arduino-2.4.1)
sleep enable,type: 1
wifi evt: 2
Connecting to OpenWrt3
sta config unchangedscandone
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 4
cnt
connected with OpenWrt3, channel 6
dhcp client start...
wifi evt: 0
.ip:192.168.1.17,mask:255.255.255.0,gw:192.168.1.1
wifi evt: 3
.
WiFi connected
IP address:
192.168.1.17
Delay
Delay
Delay
Delay
Delay
Delay
Delay
Delay
Delay
pm open,type:1 0
After this there is no more "Delay" prints, takes 10 to 12 seconds before silence. With 2.4.0 the "Delay" prints continue indefinitely.
This is what 2.4.0 gives me:
wifi evt: 2
Connecting to OpenWrt3
wifi evt: 0
wifi evt: 3
.
WiFi connected
IP address:
192.168.1.17
Delay
Delay
Delay
Delay
Delay
Delay
Delay
Delay
Delay
pm open,type:1 0
Delay
Delay
Delay
Delay
Delay
Metadata
Metadata
Assignees
Labels
No labels