More effects using FRAMETIME
This commit is contained in:
parent
de4be44728
commit
cb66900575
@ -116,7 +116,7 @@ uint16_t WS2812FX::mode_strobe_rainbow(void) {
|
|||||||
* if (bool rev == true) then LEDs are turned off in reverse order
|
* if (bool rev == true) then LEDs are turned off in reverse order
|
||||||
*/
|
*/
|
||||||
uint16_t WS2812FX::color_wipe(bool rev, bool useRandomColors) {
|
uint16_t WS2812FX::color_wipe(bool rev, bool useRandomColors) {
|
||||||
uint32_t cycleTime = 1000 + (255 - SEGMENT.speed)*200;
|
uint32_t cycleTime = 750 + (255 - SEGMENT.speed)*150;
|
||||||
uint32_t perc = now % cycleTime;
|
uint32_t perc = now % cycleTime;
|
||||||
uint16_t prog = (perc * 65535) / cycleTime;
|
uint16_t prog = (perc * 65535) / cycleTime;
|
||||||
bool back = (prog > 32767);
|
bool back = (prog > 32767);
|
||||||
@ -298,13 +298,14 @@ uint16_t WS2812FX::mode_fade(void) {
|
|||||||
*/
|
*/
|
||||||
uint16_t WS2812FX::scan(bool dual)
|
uint16_t WS2812FX::scan(bool dual)
|
||||||
{
|
{
|
||||||
if(SEGENV.step > (SEGLEN * 2) - 3) {
|
uint32_t cycleTime = 750 + (255 - SEGMENT.speed)*150;
|
||||||
SEGENV.step = 0;
|
uint32_t perc = now % cycleTime;
|
||||||
}
|
uint16_t prog = (perc * 65535) / cycleTime;
|
||||||
|
uint16_t ledIndex = (prog * ((SEGLEN * 2) - 2)) >> 16;
|
||||||
|
|
||||||
fill(SEGCOLOR(1));
|
fill(SEGCOLOR(1));
|
||||||
|
|
||||||
int led_offset = SEGENV.step - (SEGLEN - 1);
|
int led_offset = ledIndex - (SEGLEN - 1);
|
||||||
led_offset = abs(led_offset);
|
led_offset = abs(led_offset);
|
||||||
|
|
||||||
uint16_t i = SEGMENT.start + led_offset;
|
uint16_t i = SEGMENT.start + led_offset;
|
||||||
@ -315,8 +316,7 @@ uint16_t WS2812FX::scan(bool dual)
|
|||||||
setPixelColor(i2, color_from_palette(i2, true, PALETTE_SOLID_WRAP, 0));
|
setPixelColor(i2, color_from_palette(i2, true, PALETTE_SOLID_WRAP, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
SEGENV.step++;
|
return FRAMETIME;
|
||||||
return SPEED_FORMULA_L;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -507,7 +507,7 @@ uint16_t WS2812FX::dissolve(uint32_t color) {
|
|||||||
SEGENV.call = 0;
|
SEGENV.call = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 20;
|
return FRAMETIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1014,14 +1014,14 @@ uint16_t WS2812FX::mode_fireworks() {
|
|||||||
SEGENV.aux0 = index;
|
SEGENV.aux0 = index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 22;
|
return FRAMETIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Twinkling LEDs running. Inspired by https://github.com/kitesurfer1404/WS2812FX/blob/master/src/custom/Rain.h
|
//Twinkling LEDs running. Inspired by https://github.com/kitesurfer1404/WS2812FX/blob/master/src/custom/Rain.h
|
||||||
uint16_t WS2812FX::mode_rain()
|
uint16_t WS2812FX::mode_rain()
|
||||||
{
|
{
|
||||||
SEGENV.step += 22;
|
SEGENV.step += FRAMETIME;
|
||||||
if (SEGENV.step > SPEED_FORMULA_L) {
|
if (SEGENV.step > SPEED_FORMULA_L) {
|
||||||
SEGENV.step = 0;
|
SEGENV.step = 0;
|
||||||
//shift all leds right
|
//shift all leds right
|
||||||
@ -1513,7 +1513,7 @@ uint16_t WS2812FX::mode_pride_2015(void)
|
|||||||
}
|
}
|
||||||
SEGENV.step = sPseudotime;
|
SEGENV.step = sPseudotime;
|
||||||
SEGENV.aux0 = sHue16;
|
SEGENV.aux0 = sHue16;
|
||||||
return 20;
|
return FRAMETIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1664,7 +1664,7 @@ uint16_t WS2812FX::mode_colorwaves()
|
|||||||
}
|
}
|
||||||
SEGENV.step = sPseudotime;
|
SEGENV.step = sPseudotime;
|
||||||
SEGENV.aux0 = sHue16;
|
SEGENV.aux0 = sHue16;
|
||||||
return 20;
|
return FRAMETIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1693,7 +1693,7 @@ uint16_t WS2812FX::mode_fillnoise8()
|
|||||||
}
|
}
|
||||||
SEGENV.step += beatsin8(SEGMENT.speed, 1, 6); //10,1,4
|
SEGENV.step += beatsin8(SEGMENT.speed, 1, 6); //10,1,4
|
||||||
|
|
||||||
return 20;
|
return FRAMETIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t WS2812FX::mode_noise16_1()
|
uint16_t WS2812FX::mode_noise16_1()
|
||||||
@ -1720,7 +1720,7 @@ uint16_t WS2812FX::mode_noise16_1()
|
|||||||
setPixelColor(i, fastled_col.red, fastled_col.green, fastled_col.blue);
|
setPixelColor(i, fastled_col.red, fastled_col.green, fastled_col.blue);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 20;
|
return FRAMETIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1745,7 +1745,7 @@ uint16_t WS2812FX::mode_noise16_2()
|
|||||||
setPixelColor(i, fastled_col.red, fastled_col.green, fastled_col.blue);
|
setPixelColor(i, fastled_col.red, fastled_col.green, fastled_col.blue);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 20;
|
return FRAMETIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1772,7 +1772,7 @@ uint16_t WS2812FX::mode_noise16_3()
|
|||||||
setPixelColor(i, fastled_col.red, fastled_col.green, fastled_col.blue);
|
setPixelColor(i, fastled_col.red, fastled_col.green, fastled_col.blue);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 20;
|
return FRAMETIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1835,7 +1835,7 @@ uint16_t WS2812FX::mode_colortwinkle()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 20;
|
return FRAMETIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1921,7 +1921,7 @@ uint16_t WS2812FX::mode_meteor_smooth() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SEGENV.step += SEGMENT.speed +1;
|
SEGENV.step += SEGMENT.speed +1;
|
||||||
return 20;
|
return FRAMETIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2009,7 +2009,7 @@ uint16_t WS2812FX::mode_ripple()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 20;
|
return FRAMETIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -570,7 +570,7 @@ class WS2812FX {
|
|||||||
//10 names per line
|
//10 names per line
|
||||||
const char JSON_mode_names[] PROGMEM = R"=====([
|
const char JSON_mode_names[] PROGMEM = R"=====([
|
||||||
"Solid","Blink","Breathe","Wipe","Wipe Random","Random Colors","Sweep","Dynamic","Colorloop","Rainbow",
|
"Solid","Blink","Breathe","Wipe","Wipe Random","Random Colors","Sweep","Dynamic","Colorloop","Rainbow",
|
||||||
"Scan","Dual Scan","Fade","Theater","Theater Rainbow","Running","Saw","Twinkle","Dissolve","Dissolve Rnd",
|
"Scan","Scan Dual","Fade","Theater","Theater Rainbow","Running","Saw","Twinkle","Dissolve","Dissolve Rnd",
|
||||||
"Sparkle","Sparkle Dark","Sparkle+","Strobe","Strobe Rainbow","Strobe Mega","Blink Rainbow","Android","Chase","Chase Random",
|
"Sparkle","Sparkle Dark","Sparkle+","Strobe","Strobe Rainbow","Strobe Mega","Blink Rainbow","Android","Chase","Chase Random",
|
||||||
"Chase Rainbow","Chase Flash","Chase Flash Rnd","Rainbow Runner","Colorful","Traffic Light","Sweep Random","Running 2","Red & Blue","Stream",
|
"Chase Rainbow","Chase Flash","Chase Flash Rnd","Rainbow Runner","Colorful","Traffic Light","Sweep Random","Running 2","Red & Blue","Stream",
|
||||||
"Scanner","Lighthouse","Fireworks","Rain","Merry Christmas","Fire Flicker","Gradient","Loading","Police","Police All",
|
"Scanner","Lighthouse","Fireworks","Rain","Merry Christmas","Fire Flicker","Gradient","Loading","Police","Police All",
|
||||||
|
@ -98,7 +98,7 @@
|
|||||||
|
|
||||||
|
|
||||||
//version code in format yymmddb (b = daily build)
|
//version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 1912211
|
#define VERSION 1912221
|
||||||
char versionString[] = "0.9.0-b2";
|
char versionString[] = "0.9.0-b2";
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user