diff --git a/src/Arduino_ConnectionHandler.h b/src/Arduino_ConnectionHandler.h index 8d80f2ed..98a50c1e 100644 --- a/src/Arduino_ConnectionHandler.h +++ b/src/Arduino_ConnectionHandler.h @@ -118,7 +118,9 @@ INCLUDES ******************************************************************************/ -#include +#if !defined(__AVR__) +# include +#endif /****************************************************************************** TYPEDEFS diff --git a/src/Arduino_WiFiConnectionHandler.cpp b/src/Arduino_WiFiConnectionHandler.cpp index 8cfb2f06..6940235a 100644 --- a/src/Arduino_WiFiConnectionHandler.cpp +++ b/src/Arduino_WiFiConnectionHandler.cpp @@ -55,21 +55,28 @@ unsigned long WiFiConnectionHandler::getTime() NetworkConnectionState WiFiConnectionHandler::update_handleInit() { #ifndef BOARD_ESP8266 +#if !defined(__AVR__) Debug.print(DBG_INFO, F("WiFi.status(): %d"), WiFi.status()); +#endif if (WiFi.status() == NETWORK_HARDWARE_ERROR) { +#if !defined(__AVR__) Debug.print(DBG_ERROR, F("WiFi Hardware failure.\nMake sure you are using a WiFi enabled board/shield.")); Debug.print(DBG_ERROR, F("Then reset and retry.")); +#endif return NetworkConnectionState::ERROR; } - +#if !defined(__AVR__) Debug.print(DBG_ERROR, F("Current WiFi Firmware: %s"), WiFi.firmwareVersion()); +#endif #if defined(WIFI_FIRMWARE_VERSION_REQUIRED) if (WiFi.firmwareVersion() < WIFI_FIRMWARE_VERSION_REQUIRED) { +#if !defined(__AVR__) Debug.print(DBG_ERROR, F("Latest WiFi Firmware: %s"), WIFI_FIRMWARE_VERSION_REQUIRED); Debug.print(DBG_ERROR, F("Please update to the latest version for best performance.")); +#endif delay(5000); } #endif @@ -96,13 +103,17 @@ NetworkConnectionState WiFiConnectionHandler::update_handleConnecting() if (WiFi.status() != NETWORK_CONNECTED) { +#if !defined(__AVR__) Debug.print(DBG_ERROR, F("Connection to \"%s\" failed"), _ssid); Debug.print(DBG_INFO, F("Retrying in \"%d\" milliseconds"), CHECK_INTERVAL_TABLE[static_cast(NetworkConnectionState::CONNECTING)]); +#endif return NetworkConnectionState::CONNECTING; } else { +#if !defined(__AVR__) Debug.print(DBG_INFO, F("Connected to \"%s\""), _ssid); +#endif #ifdef BOARD_ESP8266 configTime(0, 0, "time.arduino.cc", "pool.ntp.org", "time.nist.gov"); #endif @@ -114,12 +125,15 @@ NetworkConnectionState WiFiConnectionHandler::update_handleConnected() { if (WiFi.status() != WL_CONNECTED) { +#if !defined(__AVR__) Debug.print(DBG_VERBOSE, F("WiFi.status(): %d"), WiFi.status()); Debug.print(DBG_ERROR, F("Connection to \"%s\" lost."), _ssid); - +#endif if (_keep_alive) { +#if !defined(__AVR__) Debug.print(DBG_ERROR, F("Attempting reconnection")); +#endif } return NetworkConnectionState::DISCONNECTED;