From a73d7a6d093a7ebf1b5f23d53e0f1208f709cc67 Mon Sep 17 00:00:00 2001 From: Jeroen88 Date: Sat, 7 Jan 2023 22:56:33 +0100 Subject: [PATCH] Added #if defined() preprocessor directives for the MCU's that can be used with the EasyOpenTherm shield --- examples/Basic_Thermostat_Commands/Basic_Thermostat_Commands.ino | 31 ++++++++++++++++++++++++++++++- examples/OpenTherm_Show_DATA-IDs/OpenTherm_Show_DATA-IDs.ino | 34 +++++++++++++++++++++++++++++----- examples/Test_Boiler_Communication/Test_Boiler_Communication.ino | 30 +++++++++++++++++++++++++++++- examples/Test_HVAC_Communication/Test_HVAC_Communication.ino | 31 ++++++++++++++++++++++++++++++- 4 files changed, 118 insertions(+), 8 deletions(-) diff --git a/examples/Basic_Thermostat_Commands/Basic_Thermostat_Commands.ino b/examples/Basic_Thermostat_Commands/Basic_Thermostat_Commands.ino index e059ea5..09c5c44 100644 --- a/examples/Basic_Thermostat_Commands/Basic_Thermostat_Commands.ino +++ b/examples/Basic_Thermostat_Commands/Basic_Thermostat_Commands.ino @@ -42,9 +42,38 @@ #include -// ESP32-S2 +#if defined(ARDUINO_LOLIN_S2_MINI) #define OT_RX_PIN (35) #define OT_TX_PIN (33) +#define DALLAS (11) +#elif defined(ARDUINO_LOLIN_C3_MINI) +#define OT_RX_PIN (10) +#define OT_TX_PIN (8) +#define DALLAS (4) +#elif defined(ARDUINO_ESP8266_WEMOS_D1MINIPRO) +// I can't get my "D1 MINI PRO Based ESP8266EX" passed a WiFi connection +// D1 is GPIO5 +#define OT_RX_PIN (5) +// D2 is GPIO4 +#define OT_TX_PIN (4) +// D7 is GPIO13 +#define DALLAS (13) +#elif defined(ESP32) +#define OT_RX_PIN (33) +#define OT_TX_PIN (16) +#define DALLAS (17) +#elif defined(ESP8266) +// GPIO5 is D1 +#define OT_RX_PIN (5) +// GPIO4 is D2 +#define OT_TX_PIN (4) +// D7 is GPIO13 +#define DALLAS (13) +#else +#define OT_RX_PIN (35) +#define OT_TX_PIN (33) +#define DALLAS (-1) +#endif #define CH_SETPOINT (60.0f) diff --git a/examples/OpenTherm_Show_DATA-IDs/OpenTherm_Show_DATA-IDs.ino b/examples/OpenTherm_Show_DATA-IDs/OpenTherm_Show_DATA-IDs.ino index f238ef4..13044db 100644 --- a/examples/OpenTherm_Show_DATA-IDs/OpenTherm_Show_DATA-IDs.ino +++ b/examples/OpenTherm_Show_DATA-IDs/OpenTherm_Show_DATA-IDs.ino @@ -1,12 +1,36 @@ #include -// ESP32-S2 -// GPIO pin used to read data from the boiler or HVAC. Must support interrupts +#if defined(ARDUINO_LOLIN_S2_MINI) #define OT_RX_PIN (35) -// GPIO pin used to send data to the boiier or HVAC. Must not be a 'read only' GPIO #define OT_TX_PIN (33) - - +#define DALLAS (11) +#elif defined(ARDUINO_LOLIN_C3_MINI) +#define OT_RX_PIN (10) +#define OT_TX_PIN (8) +#define DALLAS (4) +#elif defined(ARDUINO_ESP8266_WEMOS_D1MINIPRO) +// D1 is GPIO5 +#define OT_RX_PIN (5) +// D2 is GPIO4 +#define OT_TX_PIN (4) +// D7 is GPIO13 +#define DALLAS (13) +#elif defined(ESP32) +#define OT_RX_PIN (33) +#define OT_TX_PIN (16) +#define DALLAS (17) +#elif defined(ESP8266) +// GPIO5 is D1 +#define OT_RX_PIN (5) +// GPIO4 is D2 +#define OT_TX_PIN (4) +// D7 is GPIO13 +#define DALLAS (13) +#else +#define OT_RX_PIN (35) +#define OT_TX_PIN (33) +#define DALLAS (-1) +#endif // primaryFlags is used to tell the secondary device (boiler) what available services (Central heating, cooling, domestic hot water) it wants to make use of // The meaning of each bit is defined in enum class OpenTherm::STATUS_FLAGS diff --git a/examples/Test_Boiler_Communication/Test_Boiler_Communication.ino b/examples/Test_Boiler_Communication/Test_Boiler_Communication.ino index 7606ea2..45ae4aa 100644 --- a/examples/Test_Boiler_Communication/Test_Boiler_Communication.ino +++ b/examples/Test_Boiler_Communication/Test_Boiler_Communication.ino @@ -32,9 +32,37 @@ #include -// ESP32-S2 +#if defined(ARDUINO_LOLIN_S2_MINI) #define OT_RX_PIN (35) #define OT_TX_PIN (33) +#define DALLAS (11) +#elif defined(ARDUINO_LOLIN_C3_MINI) +#define OT_RX_PIN (10) +#define OT_TX_PIN (8) +#define DALLAS (4) +#elif defined(ARDUINO_ESP8266_WEMOS_D1MINIPRO) +// D1 is GPIO5 +#define OT_RX_PIN (5) +// D2 is GPIO4 +#define OT_TX_PIN (4) +// D7 is GPIO13 +#define DALLAS (13) +#elif defined(ESP32) +#define OT_RX_PIN (33) +#define OT_TX_PIN (16) +#define DALLAS (17) +#elif defined(ESP8266) +// GPIO5 is D1 +#define OT_RX_PIN (5) +// GPIO4 is D2 +#define OT_TX_PIN (4) +// D7 is GPIO13 +#define DALLAS (13) +#else +#define OT_RX_PIN (35) +#define OT_TX_PIN (33) +#define DALLAS (-1) +#endif void setup() { diff --git a/examples/Test_HVAC_Communication/Test_HVAC_Communication.ino b/examples/Test_HVAC_Communication/Test_HVAC_Communication.ino index cc70d80..4d3f160 100644 --- a/examples/Test_HVAC_Communication/Test_HVAC_Communication.ino +++ b/examples/Test_HVAC_Communication/Test_HVAC_Communication.ino @@ -32,9 +32,38 @@ #include -// ESP32-S2 +#if defined(ARDUINO_LOLIN_S2_MINI) #define OT_RX_PIN (35) #define OT_TX_PIN (33) +#define DALLAS (11) +#elif defined(ARDUINO_LOLIN_C3_MINI) +#define OT_RX_PIN (10) +#define OT_TX_PIN (8) +#define DALLAS (4) +#elif defined(ARDUINO_ESP8266_WEMOS_D1MINIPRO) +// I can't get my "D1 MINI PRO Based ESP8266EX" passed a WiFi connection +// D1 is GPIO5 +#define OT_RX_PIN (5) +// D2 is GPIO4 +#define OT_TX_PIN (4) +// D7 is GPIO13 +#define DALLAS (13) +#elif defined(ESP32) +#define OT_RX_PIN (33) +#define OT_TX_PIN (16) +#define DALLAS (17) +#elif defined(ESP8266) +// GPIO5 is D1 +#define OT_RX_PIN (5) +// GPIO4 is D2 +#define OT_TX_PIN (4) +// D7 is GPIO13 +#define DALLAS (13) +#else +#define OT_RX_PIN (35) +#define OT_TX_PIN (33) +#define DALLAS (-1) +#endif void setup() { -- libgit2 0.21.4