mirror of
https://github.com/wled/WLED.git
synced 2025-04-23 22:37:18 +00:00
Partial fix for #3578
This commit is contained in:
parent
391876e557
commit
7275a34e1f
@ -1022,15 +1022,16 @@ void Segment::blur(uint8_t blur_amount) {
|
||||
*/
|
||||
uint32_t Segment::color_wheel(uint8_t pos) {
|
||||
if (palette) return color_from_palette(pos, false, true, 0);
|
||||
uint8_t w = W(currentColor(0));
|
||||
pos = 255 - pos;
|
||||
if (pos < 85) {
|
||||
return ((uint32_t)(255 - pos * 3) << 16) | ((uint32_t)(0) << 8) | (pos * 3);
|
||||
return RGBW32((255 - pos * 3), 0, (pos * 3), w);
|
||||
} else if(pos < 170) {
|
||||
pos -= 85;
|
||||
return ((uint32_t)(0) << 16) | ((uint32_t)(pos * 3) << 8) | (255 - pos * 3);
|
||||
return RGBW32(0, (pos * 3), (255 - pos * 3), w);
|
||||
} else {
|
||||
pos -= 170;
|
||||
return ((uint32_t)(pos * 3) << 16) | ((uint32_t)(255 - pos * 3) << 8) | (0);
|
||||
return RGBW32((pos * 3), (255 - pos * 3), 0, w);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1044,13 +1045,10 @@ uint32_t Segment::color_wheel(uint8_t pos) {
|
||||
* @returns Single color from palette
|
||||
*/
|
||||
uint32_t Segment::color_from_palette(uint16_t i, bool mapping, bool wrap, uint8_t mcol, uint8_t pbri) {
|
||||
uint32_t color = gamma32(currentColor(mcol));
|
||||
|
||||
// default palette or no RGB support on segment
|
||||
if ((palette == 0 && mcol < NUM_COLORS) || !_isRGB) {
|
||||
uint32_t color = currentColor(mcol);
|
||||
color = gamma32(color);
|
||||
if (pbri == 255) return color;
|
||||
return color_fade(color, pbri, true);
|
||||
}
|
||||
if ((palette == 0 && mcol < NUM_COLORS) || !_isRGB) return (pbri == 255) ? color : color_fade(color, pbri, true);
|
||||
|
||||
uint8_t paletteIndex = i;
|
||||
if (mapping && virtualLength() > 1) paletteIndex = (i*255)/(virtualLength() -1);
|
||||
@ -1059,7 +1057,7 @@ uint32_t Segment::color_from_palette(uint16_t i, bool mapping, bool wrap, uint8_
|
||||
curPal = currentPalette(curPal, palette);
|
||||
CRGB fastled_col = ColorFromPalette(curPal, paletteIndex, pbri, (strip.paletteBlend == 3)? NOBLEND:LINEARBLEND); // NOTE: paletteBlend should be global
|
||||
|
||||
return RGBW32(fastled_col.r, fastled_col.g, fastled_col.b, 0);
|
||||
return RGBW32(fastled_col.r, fastled_col.g, fastled_col.b, W(color));
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user