@@ -14,7 +14,7 @@ bool ethernetIsNeeded()
1414 )
1515 return true ;
1616
17- // Does Base mode NTRIP Server need Ethernet?
17+ // Does Rover mode NTRIP Client need Ethernet?
1818 if (HAS_ETHERNET && settings.enableNtripClient == true &&
1919 (systemState >= STATE_ROVER_NOT_STARTED && systemState <= STATE_ROVER_RTK_FIX)
2020 // && !settings.ntripClientUseWiFiNotEthernet //For future expansion
@@ -56,18 +56,20 @@ void beginEthernet()
5656 Ethernet.begin (ethernetMACAddress, settings.ethernetIP , settings.ethernetDNS , settings.ethernetGateway ,
5757 settings.ethernetSubnet );
5858
59- if (Ethernet.hardwareStatus () == EthernetNoHardware)
59+ if (Ethernet.hardwareStatus () == EthernetNoHardware) // Check that a W5n00 has been detected
6060 {
6161 log_d (" Ethernet hardware not found" );
6262 online.ethernetStatus = ETH_CAN_NOT_BEGIN;
6363 return ;
6464 }
6565
6666 online.ethernetStatus = ETH_STARTED_CHECK_CABLE;
67+ lastEthernetCheck = millis (); // Wait a full second before checking the cable
68+
6769 break ;
6870
6971 case (ETH_STARTED_CHECK_CABLE):
70- if (millis () - lastEthernetCheck > 1000 ) // Don't check for cable but once a second
72+ if (millis () - lastEthernetCheck > 1000 ) // Check for cable every second
7173 {
7274 lastEthernetCheck = millis ();
7375
@@ -94,17 +96,16 @@ void beginEthernet()
9496 break ;
9597
9698 case (ETH_STARTED_START_DHCP):
97- Ethernet.begin (ethernetMACAddress);
98-
99- if (Ethernet.hardwareStatus () == EthernetNoHardware)
99+ if (millis () - lastEthernetCheck > 1000 ) // Try DHCP every second
100100 {
101- log_d (" Ethernet hardware not found" );
102- online.ethernetStatus = ETH_CAN_NOT_BEGIN;
103- return ;
104- }
101+ lastEthernetCheck = millis ();
105102
106- log_d (" Ethernet started with DHCP" );
107- online.ethernetStatus = ETH_CONNECTED;
103+ if (Ethernet.begin (ethernetMACAddress, 20000 )) // Restart Ethernet with DHCP. Use 20s timeout
104+ {
105+ log_d (" Ethernet started with DHCP" );
106+ online.ethernetStatus = ETH_CONNECTED;
107+ }
108+ }
108109 break ;
109110
110111 case (ETH_CONNECTED):
0 commit comments