mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-16 11:21:18 +03:00
Experimental: add new WiFi (pseudo) modes: WIFI_SHUTDOWN & WIFI_RESUME (#6356)
* add new WiFimodes: WIFI_SHUTDOWN & WIFI_RESUME with example * restore WiFi.onWiFiModeChange()
This commit is contained in:
@ -369,18 +369,24 @@ bool ESP8266WiFiSTAClass::reconnect() {
|
||||
* @return one value of wl_status_t enum
|
||||
*/
|
||||
bool ESP8266WiFiSTAClass::disconnect(bool wifioff) {
|
||||
bool ret;
|
||||
bool ret = false;
|
||||
struct station_config conf;
|
||||
*conf.ssid = 0;
|
||||
*conf.password = 0;
|
||||
|
||||
// API Reference: wifi_station_disconnect() need to be called after system initializes and the ESP8266 Station mode is enabled.
|
||||
if (WiFi.getMode() & WIFI_STA)
|
||||
ret = wifi_station_disconnect();
|
||||
else
|
||||
ret = true;
|
||||
|
||||
ETS_UART_INTR_DISABLE();
|
||||
if(WiFi._persistent) {
|
||||
wifi_station_set_config(&conf);
|
||||
} else {
|
||||
wifi_station_set_config_current(&conf);
|
||||
}
|
||||
ret = wifi_station_disconnect();
|
||||
|
||||
ETS_UART_INTR_ENABLE();
|
||||
|
||||
if(wifioff) {
|
||||
|
Reference in New Issue
Block a user