From b18abd3fac77aa5100785ead82b87ebf66f94e1a Mon Sep 17 00:00:00 2001 From: Will Miles Date: Thu, 22 Oct 2026 02:50:30 +0000 Subject: [PATCH 1/2] Remove setShowCallback This function is unused - no need to pay for the indirection. --- wled00/FX.h | 5 ----- wled00/FX_fcn.cpp | 5 ++--- wled00/wled.cpp | 1 - 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/wled00/FX.h b/wled00/FX.h index b431c28593..16a7269d70 100644 --- a/wled00/FX.h +++ b/wled00/FX.h @@ -813,7 +813,6 @@ class Segment { // main "strip" class (108 bytes) class WS2812FX { typedef void (*mode_ptr)(); // pointer to mode function - typedef void (*show_callback)(); // pre show callback typedef struct ModeData { uint8_t _id; // mode (effect) id mode_ptr _fcn; // mode (effect) function @@ -851,7 +850,6 @@ class WS2812FX { _segment_index(0), _mainSegment(0), _modeCount(MODE_COUNT), - _callback(nullptr), customMappingTable(nullptr), customMappingSize(0), _lastShow(0), @@ -904,7 +902,6 @@ class WS2812FX { inline void setPixelColor(unsigned n, CRGB c) const { setPixelColor(n, c.red, c.green, c.blue); } inline void fill(uint32_t c) const { for (size_t i = 0; i < getLengthTotal(); i++) setPixelColor(i, c); } // fill whole strip with color (inline) inline void trigger() { _triggered = true; } // Forces the next frame to be computed on all active segments. - inline void setShowCallback(show_callback cb) { _callback = cb; } inline void setTransition(uint16_t t) { _transitionDur = t; } // sets transition time (in ms) inline void appendSegment(uint16_t sStart=0, uint16_t sStop=30, uint16_t sStartY = 0, uint16_t sStopY = 1) { if (_segments.size() < getMaxSegments()) _segments.emplace_back(sStart,sStop,sStartY,sStopY); } @@ -1043,8 +1040,6 @@ class WS2812FX { std::vector _mode; // SRAM footprint: 4 bytes per element std::vector _modeData; // mode (effect) name and its slider control data array - show_callback _callback; - uint16_t* customMappingTable; uint16_t customMappingSize; diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index ecbeb6f1ff..d27b4be31d 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -1734,9 +1734,8 @@ void WS2812FX::show() { } } - // avoid race condition, capture _callback value - show_callback callback = _callback; - if (callback) callback(); // will call setPixelColor or setRealtimePixelColor + // Paint overlays in to pixel buffer + handleOverlayDraw(); // paint actual pixels int oldCCT = Bus::getCCT(); // store original CCT value (since it is global) diff --git a/wled00/wled.cpp b/wled00/wled.cpp index 6205706488..e05ec00862 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -604,7 +604,6 @@ void WLED::beginStrip() strip.finalizeInit(); // busses created during deserializeConfig() if config existed strip.makeAutoSegments(); strip.setBrightness(0); - strip.setShowCallback(handleOverlayDraw); doInitBusses = false; // init offMode and relay From f3b454f09168df4d1ef5e2d445fc66919cbe2587 Mon Sep 17 00:00:00 2001 From: Will Miles Date: Fri, 23 Oct 2026 00:20:28 +0000 Subject: [PATCH 2/2] Manually blank buses at boot If not using a relay, explicitly black out the LED data instead of calling the rendering engine at boot. This avoids calling usermod overlays prior to usermod setup. --- wled00/bus_manager.cpp | 9 +++++++++ wled00/bus_manager.h | 1 + wled00/wled.cpp | 6 +++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index 8242f632cc..8a1faf4f0a 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -1428,6 +1428,15 @@ void BusManager::show() { } } +void BusManager::blank() { + // Set all pixels to black + for (auto &bus : busses) { + for (uint16_t pix = 0; pix < bus->getLength(); ++pix) { + bus->setPixelColor(pix, BLACK); + } + } +} + void IRAM_ATTR BusManager::setPixelColor(unsigned pix, uint32_t c) { for (auto &bus : busses) { if (!bus->containsPixel(pix)) continue; diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index eeb10cff24..6c9c3c8c1c 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -563,6 +563,7 @@ namespace BusManager { [[gnu::hot]] uint32_t getPixelColor(unsigned pix); void show(); bool canAllShow(); + void blank(); // Set all pixels to black inline void setStatusPixel(uint32_t c) { for (auto &bus : busses) bus->setStatusPixel(c);} inline void setBrightness(uint8_t b) { for (auto &bus : busses) bus->setBrightness(b); } // for setSegmentCCT(), cct can only be in [-1,255] range; allowWBCorrection will convert it to K diff --git a/wled00/wled.cpp b/wled00/wled.cpp index e05ec00862..1bbc4f5720 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -609,7 +609,11 @@ void WLED::beginStrip() // init offMode and relay offMode = false; // init to on state to allow proper relay init handleOnOff(true); // init relay and force off - if (rlyPin < 0) strip.show(); // ensure LEDs are off if no relay is used + if (rlyPin < 0) { + // ensure LEDs are off if no relay is used + BusManager::blank(); + BusManager::show(); + } // Note on how bootup behaviour works: // if turnOnAtBoot is false: strip is set to black. It will fade in to startup brightness and orange when turned on