1111 Copyright (C) 2006-2008 Hans-Christoph Steiner. All rights reserved.
1212 Copyright (C) 2010-2011 Paul Stoffregen. All rights reserved.
1313 Copyright (C) 2009 Shigeru Kobayashi. All rights reserved.
14- Copyright (C) 2009-2016 Jeff Hoefs. All rights reserved.
14+ Copyright (C) 2009-2017 Jeff Hoefs. All rights reserved.
1515
1616 This library is free software; you can redistribute it and/or
1717 modify it under the terms of the GNU Lesser General Public
2020
2121 See file LICENSE.txt for further informations on licensing terms.
2222
23- Last updated October 16th, 2016
23+ Last updated August 13th, 2017
2424*/
2525
2626/*
@@ -832,6 +832,17 @@ void systemResetCallback()
832832 isResetting = false ;
833833}
834834
835+ void printEthernetStatus ()
836+ {
837+ DEBUG_PRINT (" Local IP Address: " );
838+ IPAddress ip = Ethernet.localIP ();
839+ DEBUG_PRINTLN (ip);
840+ #ifdef remote_ip
841+ DEBUG_PRINT (" Connecting to server at: " );
842+ DEBUG_PRINTLN (remote_ip);
843+ #endif
844+ }
845+
835846/*
836847 * StandardFirmataEthernet communicates with Ethernet shields over SPI. Therefore all
837848 * SPI pins must be set to IGNORE. Otherwise Firmata would break SPI communication.
@@ -868,15 +879,14 @@ void initTransport()
868879#ifdef local_ip
869880 Ethernet.begin ((uint8_t *)mac, local_ip); // start ethernet
870881#else
871- Ethernet.begin ((uint8_t *)mac); // start ethernet using dhcp
882+ DEBUG_PRINTLN (" Local IP will be requested from DHCP..." );
883+ // start ethernet using dhcp
884+ if (Ethernet.begin ((uint8_t *)mac) == 0 ) {
885+ DEBUG_PRINTLN (" Failed to configure Ethernet using DHCP" );
886+ }
872887#endif
873888#endif
874-
875- DEBUG_PRINTLN (" connecting..." );
876-
877- DEBUG_PRINT (" IP Address: " );
878- IPAddress ip = Ethernet.localIP ();
879- DEBUG_PRINTLN (ip);
889+ printEthernetStatus ();
880890}
881891
882892void initFirmata ()
@@ -895,7 +905,7 @@ void initFirmata()
895905
896906 // start up Network Firmata:
897907 Firmata.begin (stream);
898- systemResetCallback (); // reset to default config
908+ systemResetCallback (); // Initialize default configuration
899909}
900910
901911void setup ()
0 commit comments