Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions wled00/FX.h
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,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
Expand Down Expand Up @@ -853,7 +852,6 @@ class WS2812FX {
_segment_index(0),
_mainSegment(0),
_modeCount(MODE_COUNT),
_callback(nullptr),
customMappingTable(nullptr),
customMappingSize(0),
_lastShow(0),
Expand Down Expand Up @@ -906,7 +904,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); }
Expand Down Expand Up @@ -1045,8 +1042,6 @@ class WS2812FX {
std::vector<mode_ptr> _mode; // SRAM footprint: 4 bytes per element
std::vector<const char*> _modeData; // mode (effect) name and its slider control data array

show_callback _callback;

uint16_t* customMappingTable;
uint16_t customMappingSize;

Expand Down
5 changes: 2 additions & 3 deletions wled00/FX_fcn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions wled00/bus_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions wled00/bus_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions wled00/wled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -604,13 +604,16 @@ 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
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
Expand Down
Loading