Skip to content

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

Closed

Description

@errolt

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

Activity

  1. reloxx13 commented on Apr 20, 2018

    @reloxx13

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

  2. MikhailNatalenko commented on Jun 25, 2018

    @MikhailNatalenko

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

  3. reloxx13 commented on Jun 25, 2018

    @reloxx13

    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???

  4. reloxx13 commented on Jun 25, 2018

    @reloxx13

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

  5. MikhailNatalenko commented on Jun 25, 2018

    @MikhailNatalenko

    @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.

  6. d-a-v commented on Jun 25, 2018

    @d-a-v
    Collaborator

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

  7. errolt commented on Oct 11, 2018

    @errolt
    Author

    Fix by #5210

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions