1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-26 09:36:13 +01:00

Add loop to retry Ethernet cable connection (#173)

Implement PaulS's change to delay in a loop to give more time for sensing an Ethernet cable connection
This commit is contained in:
Fred 2021-06-10 19:02:20 -04:00 committed by GitHub
parent 766f88166c
commit 6eeaacdf90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,6 +68,16 @@ EthernetInterface::EthernetInterface()
DIAG(F("Ethernet shield not found"));
return;
}
unsigned long startmilli = millis();
while ((millis() - startmilli) < 5500) // Loop to give time to check for cable connection
{
if (Ethernet.linkStatus() == LinkON)
break;
DIAG(F("Ethernet waiting for link (1sec) "));
delay(1000);
}
if (Ethernet.linkStatus() == LinkOFF) {
DIAG(F("Ethernet cable not connected"));
return;