From b62f7037dfcc6f9181aa6293af221d5ad46343f1 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 12 Mar 2026 13:41:53 -1000 Subject: [PATCH] replace copilots broken suggestion with something that actually works --- esphome/components/mdns/mdns_rp2040.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/esphome/components/mdns/mdns_rp2040.cpp b/esphome/components/mdns/mdns_rp2040.cpp index a613ba964ae..a6aa8bd3b9a 100644 --- a/esphome/components/mdns/mdns_rp2040.cpp +++ b/esphome/components/mdns/mdns_rp2040.cpp @@ -8,17 +8,11 @@ #include "mdns_component.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 +// Save and restore our definition around the include to avoid a redefinition warning. +#pragma push_macro("IRAM_ATTR") #undef IRAM_ATTR -#endif #include -#ifdef ESPHOME_SAVED_IRAM_ATTR -#define IRAM_ATTR ESPHOME_SAVED_IRAM_ATTR -#undef ESPHOME_SAVED_IRAM_ATTR -#endif +#pragma pop_macro("IRAM_ATTR") namespace esphome::mdns {