From ef7f6fc1adfece8bf7b1af4f761f51fb1ae63763 Mon Sep 17 00:00:00 2001 From: VietDzung Date: Thu, 3 Jul 2025 14:49:45 +0700 Subject: [PATCH] Fix arduino build for ESP32 --- src/esp32_idf_platform.cpp | 4 +++- src/esp32_idf_platform.h | 2 ++ src/knx/bits.cpp | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/esp32_idf_platform.cpp b/src/esp32_idf_platform.cpp index fe4c82d..5426740 100644 --- a/src/esp32_idf_platform.cpp +++ b/src/esp32_idf_platform.cpp @@ -1,3 +1,4 @@ +#ifndef ARDUINO #ifdef ESP_PLATFORM // esp32_idf_platform.cpp #include @@ -428,4 +429,5 @@ void attachInterrupt(uint32_t pin, IsrFuncPtr callback, uint32_t mode) ESP_ERROR_CHECK(gpio_isr_handler_add((gpio_num_t)pin, isr_wrapper, (void*)callback)); } -#endif \ No newline at end of file +#endif // ESP_PLATFORM +#endif // !ARDUINO \ No newline at end of file diff --git a/src/esp32_idf_platform.h b/src/esp32_idf_platform.h index b3fc5e6..43e61ef 100644 --- a/src/esp32_idf_platform.h +++ b/src/esp32_idf_platform.h @@ -1,3 +1,4 @@ +#ifndef ARDUINO #ifdef ESP_PLATFORM // esp_idf_platform.h #pragma once @@ -82,4 +83,5 @@ class Esp32IdfPlatform : public Platform const char* _nvs_namespace = "eeprom"; const char* _nvs_key = "eeprom"; }; +#endif #endif \ No newline at end of file diff --git a/src/knx/bits.cpp b/src/knx/bits.cpp index 9bc7414..4018ca7 100644 --- a/src/knx/bits.cpp +++ b/src/knx/bits.cpp @@ -178,6 +178,7 @@ uint16_t crc16Dnp(uint8_t* input, uint16_t length) } // Produce Arduino print and println in ESP IDF for ESP32 family using printf(). +#ifndef ARDUINO #ifdef ESP_PLATFORM // Helper function to print a number in binary format static void print_binary(unsigned long long n) @@ -360,3 +361,4 @@ void println(double num) { println(); } #endif // ESP_PLATFORM +#endif // !ARDUINO