Skip to content

WiFi fpm sleep type checks in mode() #7975

Open
@mcspr

Description

@mcspr

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.

Problem Description

After #7902

if (m != WIFI_OFF && wifi_fpm_get_sleep_type() != NONE_SLEEP_T) {
// wifi starts asleep by default
wifi_fpm_do_wakeup();
wifi_fpm_close();
}

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 Sketch

#include <Arduino.h>
#include <ESP8266WiFi.h>

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

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