From 4cc3726aa5bae536649c64c1a04c6932c338ecf2 Mon Sep 17 00:00:00 2001 From: Will Miles Date: Fri, 27 Sep 2024 22:33:20 -0400 Subject: [PATCH] Better oappend shim on ESP8266 Detect IRAM pointers if we can't be sure. --- wled00/fcn_declare.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wled00/fcn_declare.h b/wled00/fcn_declare.h index 71b00599cd..f856fff97c 100644 --- a/wled00/fcn_declare.h +++ b/wled00/fcn_declare.h @@ -324,6 +324,10 @@ class Usermod { protected: // Shim for oappend(), which used to exist in utils.cpp template static inline void oappend(const T& t) { oappend_shim->print(t); }; +#ifdef ESP8266 + // Handle print(PSTR()) or print(SET_F()) without crashing by detecting PROGMEM strings + static void oappend(const char* c) { if ((intptr_t) c >= 0x40000000) oappend_shim->print(FPSTR(c)); else oappend_shim->print(c); }; +#endif }; class UsermodManager {