-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
8 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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)); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
blazoncek
Author
Collaborator
|
||
} | ||
|
||
|
||
|
This always returns the white from
gamma32(currentColor(mcol))
, right?In particular the "white" has nothing to do with
ColorFromPalette(curPal,...)
?Maybe it would be better to return luminance or avg lightness in this case:
fastled_col.getLuma()
orfastled_col.getAverageLight()
.