From 8257328d61fc4b47685146f5906d58edb95707d5 Mon Sep 17 00:00:00 2001 From: pennam Date: Wed, 16 Nov 2022 10:19:30 +0100 Subject: [PATCH 1/2] Remove newline --- src/Arduino_GSMConnectionHandler.h | 1 - 1 file changed, 1 deletion(-) 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 */ /****************************************************************************** From 40edbcced6a8a5607f6fec6e7d11f520f8a2243f Mon Sep 17 00:00:00 2001 From: pennam Date: Wed, 16 Nov 2022 11:13:18 +0100 Subject: [PATCH 2/2] Make Portenta a LoRa device if Arduino_LoRaConnectionHandler.h is included in sketch file --- src/Arduino_ConnectionHandler.h | 27 ++++++++++++++++----------- src/Arduino_LoRaConnectionHandler.cpp | 6 +++--- src/Arduino_LoRaConnectionHandler.h | 4 ++++ 3 files changed, 23 insertions(+), 14 deletions(-) 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_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_ */