Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WiFi.setSleepMode(WIFI_LIGHT_SLEEP) dies on 2.4.1 after a few seconds #4658

Closed
6 tasks done
errolt opened this issue Apr 20, 2018 · 7 comments
Closed
6 tasks done

WiFi.setSleepMode(WIFI_LIGHT_SLEEP) dies on 2.4.1 after a few seconds #4658

errolt opened this issue Apr 20, 2018 · 7 comments

Comments

@errolt
Copy link

errolt commented Apr 20, 2018

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
@reloxx13
Copy link

same here, even with latest git framework-arduinoespressif8266@src-31d658a59f41540201fc3726a1394910

@MikhailNatalenko
Copy link

I'm comfirming this bug! Guys, we need LIGHT_SLEEP_T

@reloxx13
Copy link

20 April and this just got completly ignored.

I dunno, do you guys all have free energy or why u give a fu* on this???

@reloxx13
Copy link

Same for Alexa Workaround/Losing Post Data when no header set.

@MikhailNatalenko
Copy link

@reloxx13

I suppose, it is a low level feature from SDK. It was never been supported as well, so...

Maybe @igrr can tell as more info about this super sad bug.

@d-a-v
Copy link
Collaborator

d-a-v commented Jun 25, 2018

This seems to be a bug inside the SDK itself.
What you could try is

@errolt
Copy link
Author

errolt commented Oct 11, 2018

Fix by #5210

@errolt errolt closed this as completed Oct 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants