mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-29 16:03:14 +03:00
* weak hook early_setup() #2111 #2133 #2136 * rename to early_init (more "c" vs early_setup which is more "c++arduino") * example * improve earlyWiFi example, slightly change AddrList interface, move WiFi sketches into WiFi examples * fix CI * fix local CI runner * fix local CI runner * rename early_init() to preinit() * + static ESP8266WiFiClass::preinit_wifi_off() * update early disable wifi example * example update * IPv6 example update * Update ESP8266WiFiGeneric.h camelCase for static method name * Update ESP8266WiFiGeneric.cpp camelCase for static method name * Update EarlyDisableWiFi.ino Expand comment, fix static method name * Update core_esp8266_main.cpp Expanded comment. * Update core_esp8266_main.cpp Expanded comment * Update EarlyDisableWiFi.ino Expanded comment
This commit is contained in:
committed by
Earle F. Philhower, III
parent
2ec3daa225
commit
216680bb57
@ -579,4 +579,25 @@ void wifi_dns_found_callback(const char *name, CONST ip_addr_t *ipaddr, void *ca
|
||||
esp_schedule(); // resume the hostByName function
|
||||
}
|
||||
|
||||
//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
|
||||
}
|
||||
|
@ -88,6 +88,8 @@ class ESP8266WiFiGenericClass {
|
||||
bool forceSleepBegin(uint32 sleepUs = 0);
|
||||
bool forceSleepWake();
|
||||
|
||||
static void preinitWiFiOff (); //meant to be called in user-defined preinit()
|
||||
|
||||
protected:
|
||||
static bool _persistent;
|
||||
static WiFiMode_t _forceSleepLastMode;
|
||||
|
Reference in New Issue
Block a user