mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-15 00:02:49 +03:00
add more debug for disconnect
add isConnected function for easier usage
This commit is contained in:
@ -106,6 +106,7 @@ void ESP8266WiFiGenericClass::_eventCallback(void* arg) {
|
|||||||
DEBUGV("wifi evt: %d\n", event->event);
|
DEBUGV("wifi evt: %d\n", event->event);
|
||||||
|
|
||||||
if(event->event == EVENT_STAMODE_DISCONNECTED) {
|
if(event->event == EVENT_STAMODE_DISCONNECTED) {
|
||||||
|
DEBUGV("STA disconnect: %d\n", event->event_info.disconnected.reason);
|
||||||
WiFiClient::stopAll();
|
WiFiClient::stopAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,6 +267,15 @@ bool ESP8266WiFiSTAClass::disconnect(bool wifioff) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* is STA interface connected?
|
||||||
|
* @return true if STA is connected to an AD
|
||||||
|
*/
|
||||||
|
bool ESP8266WiFiSTAClass::isConnected() {
|
||||||
|
return (status() == WL_CONNECTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setting the ESP8266 station to connect to the AP (which is recorded)
|
* Setting the ESP8266 station to connect to the AP (which is recorded)
|
||||||
* automatically or not when powered on. Enable auto-connect by default.
|
* automatically or not when powered on. Enable auto-connect by default.
|
||||||
|
@ -44,6 +44,8 @@ class ESP8266WiFiSTAClass {
|
|||||||
bool reconnect();
|
bool reconnect();
|
||||||
bool disconnect(bool wifioff = false);
|
bool disconnect(bool wifioff = false);
|
||||||
|
|
||||||
|
bool isConnected();
|
||||||
|
|
||||||
bool setAutoConnect(bool autoConnect);
|
bool setAutoConnect(bool autoConnect);
|
||||||
bool getAutoConnect();
|
bool getAutoConnect();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user