diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index b1cbffd0..26181805 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -62,7 +62,7 @@ void WS2812FX::init(bool supportWhite, uint16_t countPixels, bool skipFirst) _lengthRaw += LED_SKIP_AMOUNT; } - uint8_t pins[] = {2}; + uint8_t pins[] = {LEDPIN}; while (!busses->canAllShow()) yield(); busses->removeAll(); @@ -72,6 +72,17 @@ void WS2812FX::init(bool supportWhite, uint16_t countPixels, bool skipFirst) _segments[0].stop = _length; setBrightness(_brightness); + + #ifdef ESP8266 + for (uint8_t i = 0; i < busses->getNumBusses(); i++) { + Bus* b = busses->getBus(i); + if ((!IS_DIGITAL(b->getType()) || IS_2PIN(b->getType()))) continue; + uint8_t pins[5]; + b->getPins(pins); + BusDigital* bd = static_cast(b); + if (pins[0] == 3) bd->reinit(); + } + #endif } void WS2812FX::service() { diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index 37c12805..c92d24ec 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -102,10 +102,10 @@ class BusDigital : public Bus { } void setBrightness(uint8_t b) { - //Fix for turning off onboard LED breaking bus and quick fix for DMA not initializing correctly + //Fix for turning off onboard LED breaking bus #ifdef LED_BUILTIN if (_bri == 0 && b > 0) { - if (_pins[0] == LED_BUILTIN || _pins[1] == LED_BUILTIN || (_pins[0] == 3 && _iType < 17)) PolyBus::begin(_busPtr, _iType); + if (_pins[0] == LED_BUILTIN || _pins[1] == LED_BUILTIN) PolyBus::begin(_busPtr, _iType); } #endif _bri = b; @@ -141,6 +141,10 @@ class BusDigital : public Bus { _colorOrder = colorOrder; } + void reinit() { + PolyBus::begin(_busPtr, _iType); + } + void cleanup() { //Serial.println("Digital Cleanup"); PolyBus::cleanup(_busPtr, _iType);