-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[BREAKING] Disable WiFi at boot by default #7902
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
Changes from 13 commits
ab16b8c
6310da8
330b229
68d338e
253bbc5
5ead6a2
b2a53b7
7756427
64ff4b0
2d4ca1d
8510670
1059beb
7fd4116
c15cb5d
9d7eb2e
227e557
eca1367
8b0d641
6d9ec26
8ecc7f0
8332c42
df8f8a7
20020c0
4e5abc6
2eb8bb1
da5966b
f0f1f55
77087f0
5d12aa2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* empty wrappers to play with linker and reenable wifi at boot time | ||
*/ | ||
|
||
#include "coredecls.h" | ||
|
||
extern "C" void enableWiFiAtBootTime() | ||
{ | ||
/* | ||
* Called by user from anywhere, does nothing and allows overriding | ||
* the core_esp8266_main.cpp's default disableWiFiAtBootTime() by the | ||
* one below, at link time. | ||
*/ | ||
} | ||
|
||
extern "C" void __disableWiFiAtBootTime() | ||
{ | ||
// overrides the default __disableWiFiAtBootTime: | ||
// Does nothing: WiFi is enabled by default in nonos-sdk | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -419,7 +419,7 @@ bool ESP8266WiFiGenericClass::mode(WiFiMode_t m, WiFiState* state) { | |
} | ||
|
||
if (wifi_fpm_get_sleep_type() != NONE_SLEEP_T) { | ||
// wifi may have been put asleep by ESP8266WiFiGenericClass::preinitWiFiOff | ||
// wifi starts asleep by default | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking at esp32's ::mode: Should this be more in-line with that?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 thanks ! I added 1) and 3). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I meant exactly that, to do forcesleep with WiFi.mode(WIFI_OFF) and resume with any real mode. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They are indeed "fake" modes and described as such somewhere. There are two examples making use of them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aaah, both are already implemented as methods. So examples could use those directly? |
||
wifi_fpm_do_wakeup(); | ||
wifi_fpm_close(); | ||
} | ||
|
@@ -855,25 +855,7 @@ bool ESP8266WiFiGenericClass::resumeFromShutdown (WiFiState* state) | |
return true; | ||
} | ||
|
||
//meant to be called from user-defined ::preinit() | ||
void ESP8266WiFiGenericClass::preinitWiFiOff () { | ||
// https://github.com/esp8266/Arduino/issues/2111#issuecomment-224251391 | ||
// WiFi.persistent(false); | ||
// WiFi.mode(WIFI_OFF); | ||
// WiFi.forceSleepBegin(); | ||
|
||
//WiFi.mode(WIFI_OFF) equivalent: | ||
// datasheet: | ||
// Set Wi-Fi working mode to Station mode, SoftAP | ||
// or Station + SoftAP, and do not update flash | ||
// (not persistent) | ||
wifi_set_opmode_current(WIFI_OFF); | ||
|
||
//WiFi.forceSleepBegin(/*default*/0) equivalent: | ||
// sleep forever until wifi_fpm_do_wakeup() is called | ||
wifi_fpm_set_sleep_type(MODEM_SLEEP_T); | ||
wifi_fpm_open(); | ||
wifi_fpm_do_sleep(0xFFFFFFF); | ||
|
||
// use WiFi.forceSleepWake() to wake WiFi up | ||
// It was meant to be called from user-defined ::preinit() | ||
// It is now deprecated by enableWiFiAtBootTime() and __disableWiFiAtBootTime() | ||
} |
Uh oh!
There was an error while loading. Please reload this page.