mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2025-12-13 02:52:11 +01:00
Check the link status on Ethernet #273
This commit is contained in:
parent
48ff18030e
commit
2a3d7aa7e7
3 changed files with 8 additions and 0 deletions
|
|
@ -486,6 +486,7 @@ bool Network::openSoftAP() {
|
|||
bool Network::connected() {
|
||||
if(this->connType == conn_types::unset) return false;
|
||||
else if(this->connType == conn_types::wifi) return WiFi.status() == WL_CONNECTED;
|
||||
else if(this->connType == conn_types::ethernet) return ETH.linkUp();
|
||||
else return this->connType != conn_types::unset;
|
||||
return false;
|
||||
}
|
||||
|
|
@ -506,6 +507,13 @@ void Network::networkEvent(WiFiEvent_t event) {
|
|||
net.mac = ETH.macAddress();
|
||||
net.setConnected(conn_types::ethernet);
|
||||
break;
|
||||
/*
|
||||
case ARDUINO_EVENT_ETH_LOST_IP:
|
||||
Serial.println("Ethernet Lost IP");
|
||||
sockEmit.sendToClients("ethernet", "{\"connected\":false, \"speed\":0,\"fullduplex\":false}");
|
||||
net.connType = conn_types::unset;
|
||||
break;
|
||||
*/
|
||||
case ARDUINO_EVENT_ETH_CONNECTED:
|
||||
Serial.print("Ethernet Connected ");
|
||||
// We don't want to call setConnected if we do not have an IP address yet
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue