mirror of
https://github.com/esphome/esphome.git
synced 2025-09-05 12:52:19 +01:00
@@ -6,14 +6,3 @@
|
||||
#ifdef USE_ARDUINO
|
||||
#include <Arduino.h>
|
||||
#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
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user