esp8266 / esp8266/Arduino

WiFi fpm sleep type checks in mode()

Open
#7,975 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
16.7k
Forks
13.1k
PR merge metrics
No merged PRs in 30d

Description

### Basic Infos

- [x] This issue complies with the [issue POLICY doc](https://github.com/esp8266/Arduino/blob/master/POLICY.md).
- [x] I have read the documentation at [readthedocs](https://arduino-esp8266.readthedocs.io/en/latest) and the issue is not addressed there.
- [x] I have tested that the issue is present in current master branch (aka latest git).
- [x] I have searched the issue tracker for a similar issue.
- [x] If there is a stack dump, I have decoded it.
- [x] I have filled out all fields below.

### Problem Description

After https://github.com/esp8266/Arduino/pull/7902

https://github.com/esp8266/Arduino/blob/1cc6960a5516afb8b244e87574a57986101247bb/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp#L429-L433

In case `enableWiFiAtBootTime();` is used, `wifi_fpm_get_sleep_type() != NONE_SLEEP_T` is always true b/c SDK default is MODEM and it seems to be a setting for the wifi_fpm_open(), not the actual active mode check. Should it be set by the opposite `__disableWiFiAtBootTime()` to NONE since a lot of functions seem to skip WiFi.forceSleepBegin/Wake and directly use SDK API?

### [MCVE](https://stackoverflow.com/help/mcve) Sketch

```cpp

#include
#include

void setup() {
Serial.begin(115200);
#if 0
enableWifiAtBootTime();
#endif
Serial.println(wifi_fpm_get_sleep_type());
}

void loop() {
}

```

### Debug Messages

`#if 0` & `#if 1`
```
2
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.