diff --git a/esphome/core/macros.h b/esphome/core/macros.h index 0f0d556616..8b2383321b 100644 --- a/esphome/core/macros.h +++ b/esphome/core/macros.h @@ -6,14 +6,3 @@ #ifdef USE_ARDUINO #include #endif - -// Portable PROGMEM string macro -// On ESP8266, PSTR() stores strings in flash memory -// On other platforms, it's a no-op -#ifndef ESPHOME_PSTR -#ifdef USE_ESP8266 -#define ESPHOME_PSTR(x) PSTR(x) -#else -#define ESPHOME_PSTR(x) (x) -#endif -#endif diff --git a/esphome/cpp_helpers.py b/esphome/cpp_helpers.py index 26a7084010..5164923b2d 100644 --- a/esphome/cpp_helpers.py +++ b/esphome/cpp_helpers.py @@ -76,8 +76,11 @@ async def register_component(var, config): "Error while finding name of component, please report this", exc_info=e ) if name is not None: - # Use ESPHOME_PSTR macro which stores strings in PROGMEM on ESP8266, no-op on other platforms - add(var.set_component_source(RawExpression(f'ESPHOME_PSTR("{name}")'))) + # On ESP8266, store component source strings in PROGMEM to save RAM + if CORE.is_esp8266: + add(var.set_component_source(RawExpression(f'PSTR("{name}")'))) + else: + add(var.set_component_source(name)) add(App.register_component(var)) return var