From 4a48b70c0b0ff7a6ecca591a9b87e0d9e1fec647 Mon Sep 17 00:00:00 2001 From: felixstorm Date: Mon, 22 Apr 2019 00:14:38 +0200 Subject: [PATCH] Fix (re-)defines in HAL_ESP32 (#13780) --- Marlin/src/HAL/HAL_ESP32/HAL.h | 5 +++++ Marlin/src/HAL/HAL_ESP32/i2s.cpp | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Marlin/src/HAL/HAL_ESP32/HAL.h b/Marlin/src/HAL/HAL_ESP32/HAL.h index 3285a8b2b..16859263b 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL.h +++ b/Marlin/src/HAL/HAL_ESP32/HAL.h @@ -30,13 +30,18 @@ #include +// these are going to be re-defined in Arduino.h #undef DISABLED #undef M_PI +#undef _BV #include +// revert back to the correct (old) definition #undef DISABLED #define DISABLED(V...) DO(DIS,&&,V) +// re-define in case Arduino.h has been skipped due to earlier inclusion (i.e. in Marlin\src\HAL\HAL_ESP32\i2s.cpp) +#define _BV(b) (1UL << (b)) #include "../shared/math_32bit.h" #include "../shared/HAL_SPI.h" diff --git a/Marlin/src/HAL/HAL_ESP32/i2s.cpp b/Marlin/src/HAL/HAL_ESP32/i2s.cpp index 7aa640ea1..0345889e0 100644 --- a/Marlin/src/HAL/HAL_ESP32/i2s.cpp +++ b/Marlin/src/HAL/HAL_ESP32/i2s.cpp @@ -21,7 +21,12 @@ */ #ifdef ARDUINO_ARCH_ESP32 -#include // replace that with the proper imports +// replace that with the proper imports, then cleanup workarounds in Marlin\src\HAL\HAL_ESP32\HAL.h +#include +// revert back to the correct definition +#undef DISABLED +#define DISABLED(V...) DO(DIS,&&,V) + #include "i2s.h" #include "../../core/macros.h" #include "driver/periph_ctrl.h"