From fb88550a8d7cd23a124794110a8ebdbb075cfaba Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 12 Mar 2026 13:31:53 -1000 Subject: [PATCH] Update esphome/components/mdns/mdns_rp2040.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- esphome/components/mdns/mdns_rp2040.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/esphome/components/mdns/mdns_rp2040.cpp b/esphome/components/mdns/mdns_rp2040.cpp index 8f978f5ca8..a613ba964a 100644 --- a/esphome/components/mdns/mdns_rp2040.cpp +++ b/esphome/components/mdns/mdns_rp2040.cpp @@ -7,12 +7,18 @@ #include "esphome/core/log.h" #include "mdns_component.h" -// Arduino-Pico's PolledTimeout.h redefines IRAM_ATTR to empty; -// undef before include to avoid macro redefinition warning, then restore from hal.h. +// Arduino-Pico's PolledTimeout.h (pulled in by ESP8266mDNS.h) redefines IRAM_ATTR to empty. +// Save the current definition (from hal.h), undef before include to avoid a redefinition warning, +// then restore the original value afterwards. +#ifdef IRAM_ATTR +#define ESPHOME_SAVED_IRAM_ATTR IRAM_ATTR #undef IRAM_ATTR +#endif #include -#undef IRAM_ATTR -#include "esphome/core/hal.h" +#ifdef ESPHOME_SAVED_IRAM_ATTR +#define IRAM_ATTR ESPHOME_SAVED_IRAM_ATTR +#undef ESPHOME_SAVED_IRAM_ATTR +#endif namespace esphome::mdns {