Basic Infos
Platform
- Hardware: Any
- Core Version: 7a2e935
- Development Env: Any
Problem Description
Current code ignores setSleepMode(...) completely:
|
#ifndef NONOSDK3V0 |
|
bool ESP8266WiFiGenericClass::setSleepMode(WiFiSleepType_t type, uint8_t listenInterval) { |
|
(void)type; |
|
(void)listenInterval; |
|
return false; |
|
} |
|
#else // defined(NONOSDK3V0) |
Original change from #5763:
https://github.com/esp8266/Arduino/pull/5763/files#diff-0889054126fa6ecf0deea9d56f59e988
From PR and the related issue, I understood that light sleep mode is broken with SDK 2.x.x, but default MODEM setting is sometimes detrimental too (a lot of disconnections with some APs, when RSSI is low) and needs to be changed to NONE instead.
#include <Arduino.h>
#include <ESP8266WiFi.h>
const char* sleep_mode(WiFiSleepType_t type) {
switch (type) {
case WIFI_NONE_SLEEP: return "NONE";
case WIFI_LIGHT_SLEEP: return "LIGHT";
case WIFI_MODEM_SLEEP: return "MODEM";
default: return "UNKNOWN";
}
}
void setup() {
Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.begin(SSID, PSK);
Serial.println("connecting");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
WiFi.setSleepMode(WIFI_NONE_SLEEP);
Serial.printf("Sleep mode: %s\n", sleep_mode(WiFi.getSleepMode()));
}
void loop() {
delay(10);
}
Debug Messages
SDK 2.2.x:
SDK pre3:
Basic Infos
Platform
Problem Description
Current code ignores
setSleepMode(...)completely:Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp
Lines 252 to 258 in 7a2e935
Original change from #5763:
https://github.com/esp8266/Arduino/pull/5763/files#diff-0889054126fa6ecf0deea9d56f59e988
From PR and the related issue, I understood that light sleep mode is broken with SDK 2.x.x, but default
MODEMsetting is sometimes detrimental too (a lot of disconnections with some APs, when RSSI is low) and needs to be changed to NONE instead.MCVE Sketch
Debug Messages
SDK 2.2.x:
SDK pre3: