mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-02-17 12:12: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() {
|
bool Network::connected() {
|
||||||
if(this->connType == conn_types::unset) return false;
|
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::wifi) return WiFi.status() == WL_CONNECTED;
|
||||||
|
else if(this->connType == conn_types::ethernet) return ETH.linkUp();
|
||||||
else return this->connType != conn_types::unset;
|
else return this->connType != conn_types::unset;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -506,6 +507,13 @@ void Network::networkEvent(WiFiEvent_t event) {
|
||||||
net.mac = ETH.macAddress();
|
net.mac = ETH.macAddress();
|
||||||
net.setConnected(conn_types::ethernet);
|
net.setConnected(conn_types::ethernet);
|
||||||
break;
|
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:
|
case ARDUINO_EVENT_ETH_CONNECTED:
|
||||||
Serial.print("Ethernet Connected ");
|
Serial.print("Ethernet Connected ");
|
||||||
// We don't want to call setConnected if we do not have an IP address yet
|
// 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