mirror of
https://github.com/wled/WLED.git
synced 2025-07-20 01:06:32 +00:00
Fix for wled#4759
This commit is contained in:
parent
731f140b88
commit
929a5a8d80
@ -153,6 +153,10 @@ BusDigital::BusDigital(const BusConfig &bc, uint8_t nr)
|
|||||||
if (bc.type == TYPE_WS2812_1CH_X3) lenToCreate = NUM_ICS_WS2812_1CH_3X(bc.count); // only needs a third of "RGB" LEDs for NeoPixelBus
|
if (bc.type == TYPE_WS2812_1CH_X3) lenToCreate = NUM_ICS_WS2812_1CH_3X(bc.count); // only needs a third of "RGB" LEDs for NeoPixelBus
|
||||||
_busPtr = PolyBus::create(_iType, _pins, lenToCreate + _skip, nr);
|
_busPtr = PolyBus::create(_iType, _pins, lenToCreate + _skip, nr);
|
||||||
_valid = (_busPtr != nullptr) && bc.count > 0;
|
_valid = (_busPtr != nullptr) && bc.count > 0;
|
||||||
|
// fix for wled#4759
|
||||||
|
if (_valid) for (unsigned i = 0; i < _skip; i++) {
|
||||||
|
PolyBus::setPixelColor(_busPtr, _iType, i, 0, COL_ORDER_GRB); // set sacrificial pixels to black (CO does not matter here)
|
||||||
|
}
|
||||||
DEBUGBUS_PRINTF_P(PSTR("Bus: %successfully inited #%u (len:%u, type:%u (RGB:%d, W:%d, CCT:%d), pins:%u,%u [itype:%u] mA=%d/%d)\n"),
|
DEBUGBUS_PRINTF_P(PSTR("Bus: %successfully inited #%u (len:%u, type:%u (RGB:%d, W:%d, CCT:%d), pins:%u,%u [itype:%u] mA=%d/%d)\n"),
|
||||||
_valid?"S":"Uns",
|
_valid?"S":"Uns",
|
||||||
(int)nr,
|
(int)nr,
|
||||||
@ -230,8 +234,8 @@ void BusDigital::show() {
|
|||||||
|
|
||||||
uint8_t cctWW = 0, cctCW = 0;
|
uint8_t cctWW = 0, cctCW = 0;
|
||||||
unsigned newBri = estimateCurrentAndLimitBri(); // will fill _milliAmpsTotal (TODO: could use PolyBus::CalcTotalMilliAmpere())
|
unsigned newBri = estimateCurrentAndLimitBri(); // will fill _milliAmpsTotal (TODO: could use PolyBus::CalcTotalMilliAmpere())
|
||||||
if (newBri < _bri) PolyBus::setBrightness(_busPtr, _iType, newBri); // limit brightness to stay within current limits
|
|
||||||
if (newBri < _bri) {
|
if (newBri < _bri) {
|
||||||
|
PolyBus::setBrightness(_busPtr, _iType, newBri); // limit brightness to stay within current limits
|
||||||
unsigned hwLen = _len;
|
unsigned hwLen = _len;
|
||||||
if (_type == TYPE_WS2812_1CH_X3) hwLen = NUM_ICS_WS2812_1CH_3X(_len); // only needs a third of "RGB" LEDs for NeoPixelBus
|
if (_type == TYPE_WS2812_1CH_X3) hwLen = NUM_ICS_WS2812_1CH_3X(_len); // only needs a third of "RGB" LEDs for NeoPixelBus
|
||||||
for (unsigned i = 0; i < hwLen; i++) {
|
for (unsigned i = 0; i < hwLen; i++) {
|
||||||
@ -241,7 +245,7 @@ void BusDigital::show() {
|
|||||||
PolyBus::setPixelColor(_busPtr, _iType, i, c, 0, (cctCW<<8) | cctWW); // repaint all pixels with new brightness
|
PolyBus::setPixelColor(_busPtr, _iType, i, c, 0, (cctCW<<8) | cctWW); // repaint all pixels with new brightness
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PolyBus::show(_busPtr, _iType, false); // faster if buffer consistency is not important
|
PolyBus::show(_busPtr, _iType, _skip); // faster if buffer consistency is not important (no skipped LEDs)
|
||||||
// restore bus brightness to its original value
|
// restore bus brightness to its original value
|
||||||
// this is done right after show, so this is only OK if LED updates are completed before show() returns
|
// this is done right after show, so this is only OK if LED updates are completed before show() returns
|
||||||
// or async show has a separate buffer (ESP32 RMT and I2S are ok)
|
// or async show has a separate buffer (ESP32 RMT and I2S are ok)
|
||||||
@ -326,7 +330,7 @@ size_t BusDigital::getPins(uint8_t* pinArray) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t BusDigital::getBusSize() const {
|
size_t BusDigital::getBusSize() const {
|
||||||
return sizeof(BusDigital) + (isOk() ? PolyBus::getDataSize(_busPtr, _iType) /*+ (_data ? _len * getNumberOfChannels() : 0)*/ : 0);
|
return sizeof(BusDigital) + (isOk() ? PolyBus::getDataSize(_busPtr, _iType) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BusDigital::setColorOrder(uint8_t colorOrder) {
|
void BusDigital::setColorOrder(uint8_t colorOrder) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user