mirror of
https://github.com/wled/WLED.git
synced 2025-07-09 20:06:33 +00:00
fixes and consistency
This commit is contained in:
parent
ec938f254c
commit
d45b4ad134
@ -54,9 +54,9 @@ uint32_t color_add(uint32_t c1, uint32_t c2, bool fast)
|
||||
return RGBW32(r,g,b,w);
|
||||
} else {
|
||||
unsigned max = r;
|
||||
if (g > max) max = g;
|
||||
if (b > max) max = b;
|
||||
if (w > max) max = w;
|
||||
max = g > max ? g : max;
|
||||
max = b > max ? b : max;
|
||||
max = w > max ? w : max;
|
||||
if (max < 256) return RGBW32(r, g, b, w);
|
||||
else return RGBW32(r * 255 / max, g * 255 / max, b * 255 / max, w * 255 / max);
|
||||
}
|
||||
@ -70,7 +70,7 @@ uint32_t color_add(uint32_t c1, uint32_t c2, bool fast)
|
||||
uint32_t color_fade(uint32_t c1, uint8_t amount, bool video)
|
||||
{
|
||||
if (c1 == BLACK || amount == 0) return BLACK;
|
||||
else if (amount == 255) return c1;
|
||||
if (amount == 255) return c1;
|
||||
uint32_t scaledcolor; // color order is: W R G B from MSB to LSB
|
||||
uint32_t scale = amount; // 32bit for faster calculation
|
||||
uint32_t addRemains = 0;
|
||||
|
@ -82,7 +82,7 @@ class NeoGammaWLEDMethod {
|
||||
[[gnu::hot]] uint32_t color_blend(uint32_t,uint32_t,uint16_t,bool b16=false);
|
||||
[[gnu::hot]] uint32_t color_add(uint32_t,uint32_t, bool fast=false);
|
||||
[[gnu::hot]] uint32_t color_fade(uint32_t c1, uint8_t amount, bool video=false);
|
||||
CRGB ColorFromPaletteWLED(const CRGBPalette16 &pal, unsigned index, uint8_t brightness = (uint8_t)255U, TBlendType blendType = LINEARBLEND);
|
||||
[[gnu::hot]] CRGB ColorFromPaletteWLED(const CRGBPalette16 &pal, unsigned index, uint8_t brightness = (uint8_t)255U, TBlendType blendType = LINEARBLEND);
|
||||
CRGBPalette16 generateHarmonicRandomPalette(CRGBPalette16 &basepalette);
|
||||
CRGBPalette16 generateRandomPalette();
|
||||
inline uint32_t colorFromRgbw(byte* rgbw) { return uint32_t((byte(rgbw[3]) << 24) | (byte(rgbw[0]) << 16) | (byte(rgbw[1]) << 8) | (byte(rgbw[2]))); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user