@@ -88,13 +88,21 @@ NetworkConnectionState EthernetConnectionHandler::update_handleInit()
8888NetworkConnectionState EthernetConnectionHandler::update_handleConnecting ()
8989{
9090 if (_ip != INADDR_NONE) {
91+ #if defined(ARDUINO_TEENSY41)
92+ if (Ethernet.begin (nullptr , _ip, _dns, _gateway, _netmask) == 0 ) {
93+ #else
9194 if (Ethernet.begin (nullptr , _ip, _dns, _gateway, _netmask, _timeout, _response_timeout) == 0 ) {
95+ #endif
9296 Debug.print (DBG_ERROR, F (" Failed to configure Ethernet, check cable connection" ));
9397 Debug.print (DBG_VERBOSE, " timeout: %d, response timeout: %d" , _timeout, _response_timeout);
9498 return NetworkConnectionState::CONNECTING;
9599 }
96100 } else {
101+ #if defined(ARDUINO_TEENSY41)
102+ if (Ethernet.begin (nullptr , _timeout) == 0 ) {
103+ #else
97104 if (Ethernet.begin (nullptr , _timeout, _response_timeout) == 0 ) {
105+ #endif
98106 Debug.print (DBG_ERROR, F (" Waiting Ethernet configuration from DHCP server, check cable connection" ));
99107 Debug.print (DBG_VERBOSE, " timeout: %d, response timeout: %d" , _timeout, _response_timeout);
100108 return NetworkConnectionState::CONNECTING;
@@ -119,7 +127,11 @@ NetworkConnectionState EthernetConnectionHandler::update_handleConnected()
119127
120128NetworkConnectionState EthernetConnectionHandler::update_handleDisconnecting ()
121129{
130+ #if defined(ARDUINO_TEENSY41)
131+ Ethernet.end ();
132+ #else
122133 Ethernet.disconnect ();
134+ #endif
123135 return NetworkConnectionState::DISCONNECTED;
124136}
125137
0 commit comments