Overload temporary fix.

Non-audio SR effects.
This commit is contained in:
Blaž Kristan 2022-06-14 12:06:51 +02:00
parent e7d311d23c
commit 489b144085
2 changed files with 82 additions and 11 deletions

View File

@ -723,15 +723,15 @@ uint16_t WS2812FX::mode_android(void) {
if (a + SEGENV.aux1 < SEGLEN)
{
for(int i = a; i < a+SEGENV.aux1; i++) {
for(uint16_t i = a; i < a+SEGENV.aux1; i++) {
setPixelColor(i, SEGCOLOR(0));
}
} else
{
for(int i = a; i < SEGLEN; i++) {
for(uint16_t i = a; i < SEGLEN; i++) {
setPixelColor(i, SEGCOLOR(0));
}
for(int i = 0; i < SEGENV.aux1 - (SEGLEN -a); i++) {
for(uint16_t i = 0; i < SEGENV.aux1 - (SEGLEN -a); i++) {
setPixelColor(i, SEGCOLOR(0));
}
}
@ -4475,6 +4475,65 @@ uint16_t WS2812FX::mode_aurora(void) {
}
static const char *_data_FX_MODE_AURORA PROGMEM = "Aurora@!=24,!;1,2,3;!=50";
// WLED-SR effects
/////////////////////////
// Perlin Move //
/////////////////////////
// 16 bit perlinmove. Use Perlin Noise instead of sinewaves for movement. By Andrew Tuline.
// Controls are speed, # of pixels, faderate.
uint16_t WS2812FX::mode_perlinmove(void) {
fade_out(255-SEGMENT.custom1);
for (uint16_t i = 0; i < SEGMENT.intensity/16 + 1; i++) {
uint16_t locn = inoise16(millis()*128/(260-SEGMENT.speed)+i*15000, millis()*128/(260-SEGMENT.speed)); // Get a new pixel location from moving noise.
uint16_t pixloc = map(locn, 50*256, 192*256, 0, SEGLEN-1); // Map that to the length of the strand, and ensure we don't go over.
setPixelColor(pixloc, color_from_palette(pixloc%255, false, PALETTE_SOLID_WRAP, 0));
}
return FRAMETIME;
} // mode_perlinmove()
static const char *_data_FX_MODE_PERLINMOVE PROGMEM = "Perlin Move@!,# of pixels,fade rate;,!;!";
/////////////////////////
// Waveins //
/////////////////////////
// Uses beatsin8() + phase shifting. By: Andrew Tuline
uint16_t WS2812FX::mode_wavesins(void) {
for (uint16_t i = 0; i < SEGLEN; i++) {
uint8_t bri = sin8(millis()/4 + i * SEGMENT.intensity);
setPixelColor(i, ColorFromPalette(currentPalette, beatsin8(SEGMENT.speed, SEGMENT.custom1, SEGMENT.custom1+SEGMENT.custom2, 0, i * SEGMENT.custom3), bri, LINEARBLEND));
}
return FRAMETIME;
} // mode_waveins()
static const char *_data_FX_MODE_WAVESINS PROGMEM = "Wavesins@Speed,Brightness variation,Starting Color,Range of Colors,Color variation;;!";
//////////////////////////////
// Flow Stripe //
//////////////////////////////
// By: ldirko https://editor.soulmatelights.com/gallery/392-flow-led-stripe , modifed by: Andrew Tuline
uint16_t WS2812FX::mode_FlowStripe(void) {
const uint16_t hl = SEGLEN * 10 / 13;
uint8_t hue = millis() / (SEGMENT.speed+1);
uint32_t t = millis() / (SEGMENT.intensity/8+1);
for (uint16_t i = 0; i < SEGLEN; i++) {
int c = (abs(i - hl) / hl) * 127;
c = sin8(c);
c = sin8(c / 2 + t);
byte b = sin8(c + t/8);
setPixelColor(i, CHSV(b + hue, 255, 255));
}
return FRAMETIME;
} // mode_FlowStripe()
static const char *_data_FX_MODE_FLOWSTRIPE PROGMEM = "Flow Stripe@Hue speed,Effect speed;;";
///////////////////////////////////////////////////////////////////////////////
//*************************** 2D routines ***********************************
@ -6463,6 +6522,9 @@ const char *WS2812FX::_modeData[MODE_COUNT] = {
_data_FX_MODE_GRAVCENTER,
_data_FX_MODE_GRAVCENTRIC,
_data_FX_MODE_GRAVIMETER,
_data_FX_MODE_GRAVFREQ
_data_FX_MODE_GRAVFREQ,
_data_FX_MODE_PERLINMOVE,
_data_FX_MODE_WAVESINS,
_data_FX_MODE_FLOWSTRIPE
};

View File

@ -271,8 +271,11 @@
#define FX_MODE_GRAVCENTRIC 148
#define FX_MODE_GRAVIMETER 149
#define FX_MODE_GRAVFREQ 150
#define FX_MODE_PERLINMOVE 151
#define FX_MODE_WAVESINS 152
#define FX_MODE_FLOWSTRIPE 153
#define MODE_COUNT 151
#define MODE_COUNT 154
class WS2812FX {
@ -675,6 +678,9 @@ class WS2812FX {
_mode[FX_MODE_GRAVCENTRIC] = &WS2812FX::mode_gravcentric;
_mode[FX_MODE_GRAVIMETER] = &WS2812FX::mode_gravimeter;
_mode[FX_MODE_GRAVFREQ] = &WS2812FX::mode_gravfreq;
_mode[FX_MODE_PERLINMOVE] = &WS2812FX::mode_perlinmove;
_mode[FX_MODE_WAVESINS] = &WS2812FX::mode_wavesins;
_mode[FX_MODE_FLOWSTRIPE] = &WS2812FX::mode_FlowStripe;
_brightness = DEFAULT_BRIGHTNESS;
currentPalette = CRGBPalette16(CRGB::Black);
@ -709,15 +715,15 @@ class WS2812FX {
makeAutoSegments(bool forceReset = false),
fixInvalidSegments(),
setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b, uint8_t w = 0),
setPixelColor(float i, uint8_t r, uint8_t g, uint8_t b, uint8_t w = 0, bool aa = false),
setPixelColor(float i, uint8_t r, uint8_t g, uint8_t b, uint8_t w, bool aa),
show(void),
setTargetFps(uint8_t fps),
deserializeMap(uint8_t n=0);
inline void setPixelColor(uint16_t n, uint32_t c) {setPixelColor(n, byte(c>>16), byte(c>>8), byte(c), byte(c>>24));}
inline void setPixelColor(uint16_t n, CRGB c) {setPixelColor(n, c.red, c.green, c.blue);}
inline void setPixelColor(float i, uint32_t c, bool aa = false) {setPixelColor(i, byte(c>>16), byte(c>>8), byte(c), byte(c>>24), aa);}
inline void setPixelColor(float i, CRGB c, bool aa = false) {setPixelColor(i, c.red, c.green, c.blue, 0, aa);}
inline void setPixelColor(float i, uint32_t c, bool aa) {setPixelColor(i, byte(c>>16), byte(c>>8), byte(c), byte(c>>24), aa);}
inline void setPixelColor(float i, CRGB c, bool aa) {setPixelColor(i, c.red, c.green, c.blue, 0, aa);}
bool
gammaCorrectBri = false,
@ -905,7 +911,10 @@ class WS2812FX {
mode_candy_cane(void),
mode_blends(void),
mode_tv_simulator(void),
mode_dynamic_smooth(void);
mode_dynamic_smooth(void),
mode_perlinmove(void),
mode_wavesins(void),
mode_FlowStripe(void);
// 2D support (panels)
bool