Slight optimisation in BusDigial::getPixelColor()
This commit is contained in:
parent
57d35858d8
commit
f1e1bd41b9
@ -228,19 +228,19 @@ uint32_t BusDigital::getPixelColor(uint16_t pix) {
|
|||||||
if (_reversed) pix = _len - pix -1;
|
if (_reversed) pix = _len - pix -1;
|
||||||
else pix += _skip;
|
else pix += _skip;
|
||||||
uint8_t co = _colorOrderMap.getPixelColorOrder(pix+_start, _colorOrder);
|
uint8_t co = _colorOrderMap.getPixelColorOrder(pix+_start, _colorOrder);
|
||||||
|
uint32_t c = restoreColorLossy(PolyBus::getPixelColor(_busPtr, _iType, (_type==TYPE_WS2812_1CH_X3) ? IC_INDEX_WS2812_1CH_3X(pix) : pix, co), _bri);
|
||||||
if (_type == TYPE_WS2812_1CH_X3) { // map to correct IC, each controls 3 LEDs
|
if (_type == TYPE_WS2812_1CH_X3) { // map to correct IC, each controls 3 LEDs
|
||||||
uint16_t pOld = pix;
|
uint8_t r = R(c);
|
||||||
pix = IC_INDEX_WS2812_1CH_3X(pix);
|
uint8_t g = _reversed ? B(c) : G(c); // should G and B be switched if _reversed?
|
||||||
uint32_t c = PolyBus::getPixelColor(_busPtr, _iType, pix, co);
|
uint8_t b = _reversed ? G(c) : B(c);
|
||||||
switch (pOld % 3) { // get only the single channel
|
switch (pix % 3) { // get only the single channel
|
||||||
case 0: c = RGBW32(G(c), G(c), G(c), G(c)); break;
|
case 0: c = RGBW32(g, g, g, g); break;
|
||||||
case 1: c = RGBW32(R(c), R(c), R(c), R(c)); break;
|
case 1: c = RGBW32(r, r, r, r); break;
|
||||||
case 2: c = RGBW32(B(c), B(c), B(c), B(c)); break;
|
case 2: c = RGBW32(b, b, b, b); break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
return restoreColorLossy(PolyBus::getPixelColor(_busPtr, _iType, pix, co), _bri);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t BusDigital::getPins(uint8_t* pinArray) {
|
uint8_t BusDigital::getPins(uint8_t* pinArray) {
|
||||||
|
Loading…
Reference in New Issue
Block a user