diff --git a/src/Arduino_ConnectionHandler.h b/src/Arduino_ConnectionHandler.h index 9a5d6961..72730933 100644 --- a/src/Arduino_ConnectionHandler.h +++ b/src/Arduino_ConnectionHandler.h @@ -44,17 +44,22 @@ #endif #if defined(ARDUINO_PORTENTA_H7_M7) - #include - #include - #include - #include - - #define BOARD_HAS_WIFI - #define BOARD_HAS_ETHERNET - #define BOARD_HAS_PORTENTA_VISION_SHIELD_ETHERNET - #define NETWORK_HARDWARE_ERROR WL_NO_SHIELD - #define NETWORK_IDLE_STATUS WL_IDLE_STATUS - #define NETWORK_CONNECTED WL_CONNECTED + #if __has_include("Arduino_LoRaConnectionHandler.h") + #include + #define BOARD_HAS_LORA + #else + #include + #include + #include + #include + + #define BOARD_HAS_WIFI + #define BOARD_HAS_ETHERNET + #define BOARD_HAS_PORTENTA_VISION_SHIELD_ETHERNET + #define NETWORK_HARDWARE_ERROR WL_NO_SHIELD + #define NETWORK_IDLE_STATUS WL_IDLE_STATUS + #define NETWORK_CONNECTED WL_CONNECTED + #endif #endif #if defined(ARDUINO_NICLA_VISION) diff --git a/src/Arduino_GSMConnectionHandler.h b/src/Arduino_GSMConnectionHandler.h index 714ed8c5..11f38e7d 100644 --- a/src/Arduino_GSMConnectionHandler.h +++ b/src/Arduino_GSMConnectionHandler.h @@ -24,7 +24,6 @@ #include "Arduino_ConnectionHandler.h" - #ifdef BOARD_HAS_GSM /* Only compile if this is a board with GSM */ /****************************************************************************** diff --git a/src/Arduino_LoRaConnectionHandler.cpp b/src/Arduino_LoRaConnectionHandler.cpp index 886c7e3f..86082c53 100644 --- a/src/Arduino_LoRaConnectionHandler.cpp +++ b/src/Arduino_LoRaConnectionHandler.cpp @@ -19,10 +19,10 @@ INCLUDE ******************************************************************************/ -#if defined(ARDUINO_SAMD_MKRWAN1300) || defined(ARDUINO_SAMD_MKRWAN1310) /* Only compile if the board has LoRa */ - #include "Arduino_LoRaConnectionHandler.h" +#ifdef BOARD_HAS_LORA + /****************************************************************************** TYPEDEF ******************************************************************************/ @@ -171,4 +171,4 @@ NetworkConnectionState LoRaConnectionHandler::update_handleDisconnected() } } -#endif +#endif /* #ifdef BOARD_HAS_LORA */ diff --git a/src/Arduino_LoRaConnectionHandler.h b/src/Arduino_LoRaConnectionHandler.h index 2d76cb34..133a8db6 100644 --- a/src/Arduino_LoRaConnectionHandler.h +++ b/src/Arduino_LoRaConnectionHandler.h @@ -24,6 +24,8 @@ #include "Arduino_ConnectionHandler.h" +#ifdef BOARD_HAS_LORA /* Only compile if this is a board with LoRa */ + /****************************************************************************** CLASS DECLARATION ******************************************************************************/ @@ -72,4 +74,6 @@ class LoRaConnectionHandler : public ConnectionHandler LoRaModem _modem; }; +#endif /* #ifdef BOARD_HAS_LORA */ + #endif /* ARDUINO_LORA_CONNECTION_HANDLER_H_ */