@@ -419,7 +419,7 @@ bool ESP8266WiFiGenericClass::mode(WiFiMode_t m, WiFiState* state) {
419419 }
420420
421421 if  (wifi_fpm_get_sleep_type () != NONE_SLEEP_T) {
422-  //  wifi may have been put  asleep by ESP8266WiFiGenericClass::preinitWiFiOff 
422+  //  wifi starts  asleep by default 
423423 wifi_fpm_do_wakeup ();
424424 wifi_fpm_close ();
425425 }
@@ -855,25 +855,7 @@ bool ESP8266WiFiGenericClass::resumeFromShutdown (WiFiState* state)
855855 return  true ;
856856}
857857
858- // meant to be called from user-defined ::preinit()
859858void  ESP8266WiFiGenericClass::preinitWiFiOff  () {
860-  //  https://github.com/esp8266/Arduino/issues/2111#issuecomment-224251391
861-  //  WiFi.persistent(false);
862-  //  WiFi.mode(WIFI_OFF);
863-  //  WiFi.forceSleepBegin();
864- 
865-  // WiFi.mode(WIFI_OFF) equivalent:
866-  //  datasheet:
867-  //  Set Wi-Fi working mode to Station mode, SoftAP
868-  //  or Station + SoftAP, and do not update flash
869-  //  (not persistent)
870-  wifi_set_opmode_current (WIFI_OFF);
871- 
872-  // WiFi.forceSleepBegin(/*default*/0) equivalent:
873-  //  sleep forever until wifi_fpm_do_wakeup() is called
874-  wifi_fpm_set_sleep_type (MODEM_SLEEP_T);
875-  wifi_fpm_open ();
876-  wifi_fpm_do_sleep (0xFFFFFFF );
877- 
878-  //  use WiFi.forceSleepWake() to wake WiFi up
859+  //  It was meant to be called from user-defined ::preinit()
860+  //  It is now deprecated by enableWiFiAtBootTime() and __disableWiFiAtBootTime()
879861}
0 commit comments