mirror of
https://github.com/wled/WLED.git
synced 2025-07-20 17:26:32 +00:00
Improved theater effect
This commit is contained in:
parent
1beb9c4bb8
commit
e7a0874a57
@ -372,9 +372,17 @@ uint16_t WS2812FX::mode_rainbow_cycle(void) {
|
|||||||
* theater chase function
|
* theater chase function
|
||||||
*/
|
*/
|
||||||
uint16_t WS2812FX::theater_chase(uint32_t color1, uint32_t color2, bool dopalette) {
|
uint16_t WS2812FX::theater_chase(uint32_t color1, uint32_t color2, bool dopalette) {
|
||||||
SEGENV.call = SEGENV.call % 3;
|
byte gap = 2 + ((255 - SEGMENT.intensity) >> 5);
|
||||||
|
uint32_t cycleTime = 50 + (255 - SEGMENT.speed)*2;
|
||||||
|
uint32_t it = now / cycleTime;
|
||||||
|
if (it != SEGENV.step) //new color
|
||||||
|
{
|
||||||
|
SEGENV.aux0 = (SEGENV.aux0 +1) % gap;
|
||||||
|
SEGENV.step = it;
|
||||||
|
}
|
||||||
|
|
||||||
for(uint16_t i=0; i < SEGLEN; i++) {
|
for(uint16_t i=0; i < SEGLEN; i++) {
|
||||||
if((i % 3) == SEGENV.call) {
|
if((i % gap) == SEGENV.aux0) {
|
||||||
if (dopalette)
|
if (dopalette)
|
||||||
{
|
{
|
||||||
setPixelColor(SEGMENT.start + i, color_from_palette(SEGMENT.start + i, true, PALETTE_SOLID_WRAP, 0));
|
setPixelColor(SEGMENT.start + i, color_from_palette(SEGMENT.start + i, true, PALETTE_SOLID_WRAP, 0));
|
||||||
@ -385,7 +393,7 @@ uint16_t WS2812FX::theater_chase(uint32_t color1, uint32_t color2, bool dopalett
|
|||||||
setPixelColor(SEGMENT.start + i, color2);
|
setPixelColor(SEGMENT.start + i, color2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 50 + (2 * (uint32_t)(255 - SEGMENT.speed));
|
return FRAMETIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@
|
|||||||
|
|
||||||
|
|
||||||
//version code in format yymmddb (b = daily build)
|
//version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 1910293
|
#define VERSION 1911031
|
||||||
char versionString[] = "0.8.6";
|
char versionString[] = "0.8.6";
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ void colorHStoRGB(uint16_t hue, byte sat, byte* rgb) //hue, sat to rgb
|
|||||||
case 4: rgb[0]=t,rgb[1]=p,rgb[2]=255;break;
|
case 4: rgb[0]=t,rgb[1]=p,rgb[2]=255;break;
|
||||||
case 5: rgb[0]=255,rgb[1]=p,rgb[2]=q;
|
case 5: rgb[0]=255,rgb[1]=p,rgb[2]=q;
|
||||||
}
|
}
|
||||||
|
if (useRGBW) colorRGBtoRGBW(col);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WLED_DISABLE_HUESYNC
|
#ifndef WLED_DISABLE_HUESYNC
|
||||||
@ -50,6 +51,7 @@ void colorCTtoRGB(uint16_t mired, byte* rgb) //white spectrum to rgb
|
|||||||
} else {
|
} else {
|
||||||
rgb[0]=237;rgb[1]=255;rgb[2]=239;//150
|
rgb[0]=237;rgb[1]=255;rgb[2]=239;//150
|
||||||
}
|
}
|
||||||
|
if (useRGBW) colorRGBtoRGBW(col);
|
||||||
}
|
}
|
||||||
|
|
||||||
void colorXYtoRGB(float x, float y, byte* rgb) //coordinates to rgb (https://www.developers.meethue.com/documentation/color-conversions-rgb-xy)
|
void colorXYtoRGB(float x, float y, byte* rgb) //coordinates to rgb (https://www.developers.meethue.com/documentation/color-conversions-rgb-xy)
|
||||||
@ -106,6 +108,7 @@ void colorXYtoRGB(float x, float y, byte* rgb) //coordinates to rgb (https://www
|
|||||||
rgb[0] = 255.0*r;
|
rgb[0] = 255.0*r;
|
||||||
rgb[1] = 255.0*g;
|
rgb[1] = 255.0*g;
|
||||||
rgb[2] = 255.0*b;
|
rgb[2] = 255.0*b;
|
||||||
|
if (useRGBW) colorRGBtoRGBW(col);
|
||||||
}
|
}
|
||||||
|
|
||||||
void colorRGBtoXY(byte* rgb, float* xy) //rgb to coordinates (https://www.developers.meethue.com/documentation/color-conversions-rgb-xy)
|
void colorRGBtoXY(byte* rgb, float* xy) //rgb to coordinates (https://www.developers.meethue.com/documentation/color-conversions-rgb-xy)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user