Dynamic fade effect (#1550)
* New Effect "TV Simulator" based on "Fake TV Light for Engineers" by Phillip Burgess https://learn.adafruit.com/fake-tv-light-for-engineers/arduino-sketch * removed some not-used functions ...from my 1st attempt with "Phoney TV" - but this one did not look good. * Dynamic Effect extended with a "smooth" variant ...to close #1114 / the "Dynamice fade effect" in the projects section Co-authored-by: Aircoookie <dev.aircoookie@gmail.com>
This commit is contained in:
parent
e16bab8dd9
commit
a91d993c6d
@ -234,9 +234,9 @@ uint16_t WS2812FX::mode_random_color(void) {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Lights every LED in a random color. Changes all LED at the same time
|
* Lights every LED in a random color. Changes all LED at the same time
|
||||||
// * to new random colors.
|
* to new random colors.
|
||||||
*/
|
*/
|
||||||
uint16_t WS2812FX::mode_dynamic(void) {
|
uint16_t WS2812FX::dynamic(boolean smooth=false) {
|
||||||
if (!SEGENV.allocateData(SEGLEN)) return mode_static(); //allocation failed
|
if (!SEGENV.allocateData(SEGLEN)) return mode_static(); //allocation failed
|
||||||
|
|
||||||
if(SEGENV.call == 0) {
|
if(SEGENV.call == 0) {
|
||||||
@ -253,12 +253,31 @@ uint16_t WS2812FX::mode_dynamic(void) {
|
|||||||
SEGENV.step = it;
|
SEGENV.step = it;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint16_t i = 0; i < SEGLEN; i++) {
|
if (smooth) {
|
||||||
setPixelColor(i, color_wheel(SEGENV.data[i]));
|
for (uint16_t i = 0; i < SEGLEN; i++) {
|
||||||
}
|
blendPixelColor(i, color_wheel(SEGENV.data[i]),16);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (uint16_t i = 0; i < SEGLEN; i++) {
|
||||||
|
setPixelColor(i, color_wheel(SEGENV.data[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Original effect "Dynamic"
|
||||||
|
*/
|
||||||
|
uint16_t WS2812FX::mode_dynamic(void) {
|
||||||
|
return dynamic(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* effect "Dynamic" with smoth color-fading
|
||||||
|
*/
|
||||||
|
uint16_t WS2812FX::mode_dynamic_smooth(void) {
|
||||||
|
return dynamic(true);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Does the "standby-breathing" of well known i-Devices.
|
* Does the "standby-breathing" of well known i-Devices.
|
||||||
@ -3755,6 +3774,7 @@ uint16_t WS2812FX::mode_blends(void) {
|
|||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef WLED_DISABLE_FX_HIGH_FLASH_USE
|
||||||
typedef struct TvSim {
|
typedef struct TvSim {
|
||||||
uint32_t totalTime = 0;
|
uint32_t totalTime = 0;
|
||||||
uint32_t fadeTime = 0;
|
uint32_t fadeTime = 0;
|
||||||
@ -3767,6 +3787,7 @@ typedef struct TvSim {
|
|||||||
} tvSim;
|
} tvSim;
|
||||||
|
|
||||||
#define numTVPixels (sizeof(tv_colors) / 2) // 2 bytes per Pixel (5/6/5)
|
#define numTVPixels (sizeof(tv_colors) / 2) // 2 bytes per Pixel (5/6/5)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TV Simulator
|
TV Simulator
|
||||||
|
11
wled00/FX.h
11
wled00/FX.h
@ -119,7 +119,8 @@
|
|||||||
#define IS_REVERSE ((SEGMENT.options & REVERSE ) == REVERSE )
|
#define IS_REVERSE ((SEGMENT.options & REVERSE ) == REVERSE )
|
||||||
#define IS_SELECTED ((SEGMENT.options & SELECTED ) == SELECTED )
|
#define IS_SELECTED ((SEGMENT.options & SELECTED ) == SELECTED )
|
||||||
|
|
||||||
#define MODE_COUNT 117
|
|
||||||
|
#define MODE_COUNT 118
|
||||||
|
|
||||||
#define FX_MODE_STATIC 0
|
#define FX_MODE_STATIC 0
|
||||||
#define FX_MODE_BLINK 1
|
#define FX_MODE_BLINK 1
|
||||||
@ -238,6 +239,7 @@
|
|||||||
#define FX_MODE_CANDY_CANE 114
|
#define FX_MODE_CANDY_CANE 114
|
||||||
#define FX_MODE_BLENDS 115
|
#define FX_MODE_BLENDS 115
|
||||||
#define FX_MODE_TV_SIMULATOR 116
|
#define FX_MODE_TV_SIMULATOR 116
|
||||||
|
#define FX_MODE_DYNAMIC_SMOOTH 117
|
||||||
|
|
||||||
class WS2812FX {
|
class WS2812FX {
|
||||||
typedef uint16_t (WS2812FX::*mode_ptr)(void);
|
typedef uint16_t (WS2812FX::*mode_ptr)(void);
|
||||||
@ -468,6 +470,7 @@ class WS2812FX {
|
|||||||
_mode[FX_MODE_CANDY_CANE] = &WS2812FX::mode_candy_cane;
|
_mode[FX_MODE_CANDY_CANE] = &WS2812FX::mode_candy_cane;
|
||||||
_mode[FX_MODE_BLENDS] = &WS2812FX::mode_blends;
|
_mode[FX_MODE_BLENDS] = &WS2812FX::mode_blends;
|
||||||
_mode[FX_MODE_TV_SIMULATOR] = &WS2812FX::mode_tv_simulator;
|
_mode[FX_MODE_TV_SIMULATOR] = &WS2812FX::mode_tv_simulator;
|
||||||
|
_mode[FX_MODE_DYNAMIC_SMOOTH] = &WS2812FX::mode_dynamic_smooth;
|
||||||
|
|
||||||
_brightness = DEFAULT_BRIGHTNESS;
|
_brightness = DEFAULT_BRIGHTNESS;
|
||||||
currentPalette = CRGBPalette16(CRGB::Black);
|
currentPalette = CRGBPalette16(CRGB::Black);
|
||||||
@ -679,7 +682,8 @@ class WS2812FX {
|
|||||||
mode_washing_machine(void),
|
mode_washing_machine(void),
|
||||||
mode_candy_cane(void),
|
mode_candy_cane(void),
|
||||||
mode_blends(void),
|
mode_blends(void),
|
||||||
mode_tv_simulator(void);
|
mode_tv_simulator(void),
|
||||||
|
mode_dynamic_smooth(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NeoPixelWrapper *bus;
|
NeoPixelWrapper *bus;
|
||||||
@ -712,6 +716,7 @@ class WS2812FX {
|
|||||||
blink(uint32_t, uint32_t, bool strobe, bool),
|
blink(uint32_t, uint32_t, bool strobe, bool),
|
||||||
candle(bool),
|
candle(bool),
|
||||||
color_wipe(bool, bool),
|
color_wipe(bool, bool),
|
||||||
|
dynamic(bool),
|
||||||
scan(bool),
|
scan(bool),
|
||||||
theater_chase(uint32_t, uint32_t, bool),
|
theater_chase(uint32_t, uint32_t, bool),
|
||||||
running_base(bool),
|
running_base(bool),
|
||||||
@ -767,7 +772,7 @@ const char JSON_mode_names[] PROGMEM = R"=====([
|
|||||||
"Twinklefox","Twinklecat","Halloween Eyes","Solid Pattern","Solid Pattern Tri","Spots","Spots Fade","Glitter","Candle","Fireworks Starburst",
|
"Twinklefox","Twinklecat","Halloween Eyes","Solid Pattern","Solid Pattern Tri","Spots","Spots Fade","Glitter","Candle","Fireworks Starburst",
|
||||||
"Fireworks 1D","Bouncing Balls","Sinelon","Sinelon Dual","Sinelon Rainbow","Popcorn","Drip","Plasma","Percent","Ripple Rainbow",
|
"Fireworks 1D","Bouncing Balls","Sinelon","Sinelon Dual","Sinelon Rainbow","Popcorn","Drip","Plasma","Percent","Ripple Rainbow",
|
||||||
"Heartbeat","Pacifica","Candle Multi", "Solid Glitter","Sunrise","Phased","Twinkleup","Noise Pal", "Sine","Phased Noise",
|
"Heartbeat","Pacifica","Candle Multi", "Solid Glitter","Sunrise","Phased","Twinkleup","Noise Pal", "Sine","Phased Noise",
|
||||||
"Flow","Chunchun","Dancing Shadows","Washing Machine","Candy Cane","Blends","TV Simulator"
|
"Flow","Chunchun","Dancing Shadows","Washing Machine","Candy Cane","Blends","TV Simulator","Dynamic Smooth"
|
||||||
])=====";
|
])=====";
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user