mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-16 11:21:18 +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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -80,6 +80,8 @@ class ESP8266WiFiClass {
|
||||
void config(IPAddress local_ip, IPAddress gateway, IPAddress subnet);
|
||||
void config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns);
|
||||
|
||||
|
||||
bool reconnect();
|
||||
int disconnect(bool wifioff = false);
|
||||
|
||||
uint8_t waitForConnectResult();
|
||||
|
Reference in New Issue
Block a user