From bc943e06e6de08bde510f352e3710af0cf49966e Mon Sep 17 00:00:00 2001 From: unregist <22579156+unregist@users.noreply.github.com> Date: Fri, 6 Dec 2024 09:37:48 +1000 Subject: [PATCH 1/2] add MIN and MAX definitions to support ESP32 (non-C3) add MIN and MAX definitions to support ESP32 (non-C3) --- esphome/components/MhiAcCtrl/MHI-AC-Ctrl-core.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/esphome/components/MhiAcCtrl/MHI-AC-Ctrl-core.h b/esphome/components/MhiAcCtrl/MHI-AC-Ctrl-core.h index 79a010d..3a5cb7a 100644 --- a/esphome/components/MhiAcCtrl/MHI-AC-Ctrl-core.h +++ b/esphome/components/MhiAcCtrl/MHI-AC-Ctrl-core.h @@ -39,6 +39,13 @@ #define MHI_NUM_FRAMES_PER_INTERVAL 20 // every 20 frames, MISO_frame[DB14] bit2 toggles +#ifndef MIN +#define MIN(x, y) (((x) < (y)) ? (x) : (y)) +#endif +#ifndef MAX +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) +#endif + namespace mhi_ac { enum class ACPower { From b30e28c8a8521dcf409f7597391ae055771ebe29 Mon Sep 17 00:00:00 2001 From: Rob <22579156+unregist@users.noreply.github.com> Date: Sat, 7 Dec 2024 09:24:54 +1000 Subject: [PATCH 2/2] Update MHI-AC-Ctrl-core.cpp ESP32 (non C3) does not have clk_src --- esphome/components/MhiAcCtrl/MHI-AC-Ctrl-core.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/esphome/components/MhiAcCtrl/MHI-AC-Ctrl-core.cpp b/esphome/components/MhiAcCtrl/MHI-AC-Ctrl-core.cpp index 685c0ee..d61bd4a 100644 --- a/esphome/components/MhiAcCtrl/MHI-AC-Ctrl-core.cpp +++ b/esphome/components/MhiAcCtrl/MHI-AC-Ctrl-core.cpp @@ -528,7 +528,9 @@ void mhi_ac_ctrl_core_init(const Config& config) { .counter_dir = TIMER_COUNT_UP, .auto_reload = TIMER_AUTORELOAD_DIS, .divider = TIMER_DIVIDER, + #if SOC_TIMER_GROUP_SUPPORT_XTAL .clk_src = TIMER_SRC_CLK_APB + #endif }; timer_init(TIMER_GROUP_0, TIMER_0, &timer_config);