add sinelon effect
This commit is contained in:
parent
7ca1970fff
commit
86ae11f4c4
@ -2348,4 +2348,29 @@ uint16_t WS2812FX::mode_BouncingBalls(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 20;
|
return 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sinelon stolen from FASTLED examples
|
||||||
|
*/
|
||||||
|
uint16_t WS2812FX::mode_sinelon(void) {
|
||||||
|
|
||||||
|
fade_out(SEGMENT.intensity);
|
||||||
|
int pos = beatsin16(SEGMENT.speed/10,0,SEGLEN-1);
|
||||||
|
static int prevpos = 0;
|
||||||
|
|
||||||
|
// setRange seems great to use, but doesn't work here for some reason
|
||||||
|
if( pos < prevpos ) {
|
||||||
|
for (uint16_t i = pos; i < prevpos; i++)
|
||||||
|
{
|
||||||
|
setPixelColor(i, color_from_palette(pos, false, false, 0));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (uint16_t i = prevpos; i < pos; i++)
|
||||||
|
{
|
||||||
|
setPixelColor(i, color_from_palette(pos, false, false, 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
prevpos = pos;
|
||||||
|
return FRAMETIME;
|
||||||
}
|
}
|
@ -84,7 +84,7 @@
|
|||||||
#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 88
|
#define MODE_COUNT 89
|
||||||
|
|
||||||
#define FX_MODE_STATIC 0
|
#define FX_MODE_STATIC 0
|
||||||
#define FX_MODE_BLINK 1
|
#define FX_MODE_BLINK 1
|
||||||
@ -174,6 +174,7 @@
|
|||||||
#define FX_MODE_SPOTS 85
|
#define FX_MODE_SPOTS 85
|
||||||
#define FX_MODE_SPOTS_FADE 86
|
#define FX_MODE_SPOTS_FADE 86
|
||||||
#define FX_MODE_BOUNCINGBALLS 87
|
#define FX_MODE_BOUNCINGBALLS 87
|
||||||
|
#define FX_MODE_SINELON 88
|
||||||
|
|
||||||
|
|
||||||
class WS2812FX {
|
class WS2812FX {
|
||||||
@ -319,6 +320,7 @@ class WS2812FX {
|
|||||||
_mode[FX_MODE_SPOTS] = &WS2812FX::mode_spots;
|
_mode[FX_MODE_SPOTS] = &WS2812FX::mode_spots;
|
||||||
_mode[FX_MODE_SPOTS_FADE] = &WS2812FX::mode_spots_fade;
|
_mode[FX_MODE_SPOTS_FADE] = &WS2812FX::mode_spots_fade;
|
||||||
_mode[FX_MODE_BOUNCINGBALLS] = &WS2812FX::mode_BouncingBalls;
|
_mode[FX_MODE_BOUNCINGBALLS] = &WS2812FX::mode_BouncingBalls;
|
||||||
|
_mode[FX_MODE_SINELON] = &WS2812FX::mode_sinelon;
|
||||||
|
|
||||||
_brightness = DEFAULT_BRIGHTNESS;
|
_brightness = DEFAULT_BRIGHTNESS;
|
||||||
currentPalette = CRGBPalette16(CRGB::Black);
|
currentPalette = CRGBPalette16(CRGB::Black);
|
||||||
@ -500,7 +502,8 @@ class WS2812FX {
|
|||||||
mode_tri_static_pattern(void),
|
mode_tri_static_pattern(void),
|
||||||
mode_spots(void),
|
mode_spots(void),
|
||||||
mode_spots_fade(void),
|
mode_spots_fade(void),
|
||||||
mode_BouncingBalls(void);
|
mode_BouncingBalls(void),
|
||||||
|
mode_sinelon(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NeoPixelWrapper *bus;
|
NeoPixelWrapper *bus;
|
||||||
@ -573,7 +576,7 @@ const char JSON_mode_names[] PROGMEM = R"=====([
|
|||||||
"Two Dots","Two Areas","Circus","Halloween","Tri Chase","Tri Wipe","Tri Fade","Lightning","ICU","Multi Comet",
|
"Two Dots","Two Areas","Circus","Halloween","Tri Chase","Tri Wipe","Tri Fade","Lightning","ICU","Multi Comet",
|
||||||
"Dual Scanner","Stream 2","Oscillate","Pride 2015","Juggle","Palette","Fire 2012","Colorwaves","Bpm","Fill Noise",
|
"Dual Scanner","Stream 2","Oscillate","Pride 2015","Juggle","Palette","Fire 2012","Colorwaves","Bpm","Fill Noise",
|
||||||
"Noise 1","Noise 2","Noise 3","Noise 4","Colortwinkles","Lake","Meteor","Smooth Meteor","Railway","Ripple",
|
"Noise 1","Noise 2","Noise 3","Noise 4","Colortwinkles","Lake","Meteor","Smooth Meteor","Railway","Ripple",
|
||||||
"Twinklefox","Twinklecat","Halloween Eyes","Solid Pattern","Solid Pattern Tri","Spots","Spots Fade","Bouncing Balls"
|
"Twinklefox","Twinklecat","Halloween Eyes","Solid Pattern","Solid Pattern Tri","Spots","Spots Fade","Bouncing Balls", "Sinelon"
|
||||||
])=====";
|
])=====";
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user