mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
add reconnect function for STA
This commit is contained in:
@ -284,6 +284,18 @@ void ESP8266WiFiClass::config(IPAddress local_ip, IPAddress gateway, IPAddress s
|
|||||||
_useStaticIp = true;
|
_useStaticIp = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* will force a disconnect an then start reconnecting to AP
|
||||||
|
* @return ok
|
||||||
|
*/
|
||||||
|
bool ESP8266WiFiClass::reconnect() {
|
||||||
|
if((getMode() & WIFI_STA) != 0) {
|
||||||
|
if(wifi_station_disconnect()) {
|
||||||
|
return wifi_station_connect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disconnect from the network
|
* Disconnect from the network
|
||||||
|
@ -80,6 +80,8 @@ class ESP8266WiFiClass {
|
|||||||
void config(IPAddress local_ip, IPAddress gateway, IPAddress subnet);
|
void config(IPAddress local_ip, IPAddress gateway, IPAddress subnet);
|
||||||
void config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns);
|
void config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns);
|
||||||
|
|
||||||
|
|
||||||
|
bool reconnect();
|
||||||
int disconnect(bool wifioff = false);
|
int disconnect(bool wifioff = false);
|
||||||
|
|
||||||
uint8_t waitForConnectResult();
|
uint8_t waitForConnectResult();
|
||||||
|
Reference in New Issue
Block a user