mirror of
https://github.com/wled/WLED.git
synced 2025-07-23 18:56:41 +00:00
commit
59fbc51283
@ -11,6 +11,9 @@ byte wipeState = 0; //0: inactive 1: wiping 2: solid
|
||||
unsigned long timeStaticStart = 0;
|
||||
uint16_t previousUserVar0 = 0;
|
||||
|
||||
//comment this out if you want the turn off effect to be just fading out instead of reverse wipe
|
||||
#define STAIRCASE_WIPE_OFF
|
||||
|
||||
//gets called once at boot. Do all initialization that doesn't depend on network here
|
||||
void userSetup()
|
||||
{
|
||||
@ -52,14 +55,28 @@ void userLoop()
|
||||
{
|
||||
if (millis() - timeStaticStart > userVar1*1000) wipeState = 3;
|
||||
}
|
||||
} else { //wipeState == 3, turn off slowly
|
||||
} else if (wipeState == 3) { //switch to wipe off
|
||||
#ifdef STAIRCASE_WIPE_OFF
|
||||
effectCurrent = FX_MODE_COLOR_WIPE;
|
||||
strip.timebase = 360 + (255 - effectSpeed)*75 - millis(); //make sure wipe starts fully lit
|
||||
colorUpdated(3);
|
||||
wipeState = 4;
|
||||
#else
|
||||
turnOff();
|
||||
userVar0 = 0;
|
||||
wipeState = 0;
|
||||
#endif
|
||||
} else { //wiping off
|
||||
if (millis() + strip.timebase > (725 + (255 - effectSpeed)*150)) turnOff(); //wipe complete
|
||||
}
|
||||
} else {
|
||||
if (previousUserVar0) turnOff();
|
||||
wipeState = 0; //reset for next time
|
||||
if (previousUserVar0) {
|
||||
#ifdef STAIRCASE_WIPE_OFF
|
||||
userVar0 = previousUserVar0;
|
||||
wipeState = 3;
|
||||
#else
|
||||
turnOff();
|
||||
#endif
|
||||
}
|
||||
previousUserVar0 = 0;
|
||||
}
|
||||
}
|
||||
@ -81,7 +98,14 @@ void startWipe()
|
||||
|
||||
void turnOff()
|
||||
{
|
||||
transitionDelayTemp = 4000;
|
||||
#ifdef STAIRCASE_WIPE_OFF
|
||||
transitionDelayTemp = 0; //turn off immediately after wipe completed
|
||||
#else
|
||||
transitionDelayTemp = 4000; //fade out slowly
|
||||
#endif
|
||||
bri = 0;
|
||||
colorUpdated(3);
|
||||
wipeState = 0;
|
||||
userVar0 = 0;
|
||||
previousUserVar0 = 0;
|
||||
}
|
||||
|
@ -1720,7 +1720,8 @@ uint16_t WS2812FX::mode_colorwaves()
|
||||
uint8_t msmultiplier = beatsin88(147, 23, 60);
|
||||
|
||||
uint16_t hue16 = sHue16;//gHue * 256;
|
||||
uint16_t hueinc16 = beatsin88(113, 300, 1500);
|
||||
// uint16_t hueinc16 = beatsin88(113, 300, 1500);
|
||||
uint16_t hueinc16 = beatsin88(113, 60, 300)*SEGMENT.intensity*10/255; // Use the Intensity Slider for the hues
|
||||
|
||||
sPseudotime += duration * msmultiplier;
|
||||
sHue16 += duration * beatsin88(400, 5, 9);
|
||||
@ -2890,7 +2891,7 @@ uint16_t WS2812FX::mode_exploding_fireworks(void)
|
||||
uint16_t WS2812FX::mode_drip(void)
|
||||
{
|
||||
//allocate segment data
|
||||
uint16_t numDrops = 2;
|
||||
uint16_t numDrops = 4;
|
||||
uint16_t dataSize = sizeof(spark) * numDrops;
|
||||
if (!SEGENV.allocateData(dataSize)) return mode_static(); //allocation failed
|
||||
|
||||
@ -2898,6 +2899,8 @@ uint16_t WS2812FX::mode_drip(void)
|
||||
|
||||
Spark* drops = reinterpret_cast<Spark*>(SEGENV.data);
|
||||
|
||||
numDrops = 1 + (SEGMENT.intensity >> 6);
|
||||
|
||||
float gravity = -0.001 - (SEGMENT.speed/50000.0);
|
||||
gravity *= SEGLEN;
|
||||
int sourcedrop = 12;
|
||||
@ -2915,7 +2918,7 @@ uint16_t WS2812FX::mode_drip(void)
|
||||
if (drops[j].col>255) drops[j].col=255;
|
||||
setPixelColor(int(drops[j].pos),color_blend(BLACK,SEGCOLOR(0),drops[j].col));
|
||||
|
||||
drops[j].col += map(SEGMENT.intensity, 0, 255, 1, 6); // swelling
|
||||
drops[j].col += map(SEGMENT.speed, 0, 255, 1, 6); // swelling
|
||||
|
||||
if (random8() < drops[j].col/10) { // random drop
|
||||
drops[j].colIndex=2; //fall
|
||||
@ -2954,3 +2957,22 @@ uint16_t WS2812FX::mode_drip(void)
|
||||
}
|
||||
return FRAMETIME;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/ Plasma Effect
|
||||
/ adapted from https://github.com/atuline/FastLED-Demos/blob/master/plasma/plasma.ino
|
||||
*/
|
||||
uint16_t WS2812FX::mode_plasma(void) {
|
||||
uint8_t thisPhase = beatsin8(6,-64,64); // Setting phase change for a couple of waves.
|
||||
uint8_t thatPhase = beatsin8(7,-64,64);
|
||||
|
||||
for (int i = 0; i < SEGLEN; i++) { // For each of the LED's in the strand, set color & brightness based on a wave as follows:
|
||||
uint8_t colorIndex = cubicwave8((i*(1+ 3*(SEGMENT.speed >> 5)))+(thisPhase) & 0xFF)/2 // factor=23 // Create a wave and add a phase change and add another wave with its own phase change.
|
||||
+ cos8((i*(1+ 2*(SEGMENT.speed >> 5)))+(thatPhase) & 0xFF)/2; // factor=15 // Hey, you can even change the frequencies if you wish.
|
||||
uint8_t thisBright = qsub8(colorIndex, beatsin8(6,0,128));
|
||||
setPixelColor(i, color_blend(SEGCOLOR(1), color_from_palette(colorIndex, false, false, 0), thisBright));
|
||||
}
|
||||
|
||||
return FRAMETIME;
|
||||
}
|
||||
|
@ -91,7 +91,7 @@
|
||||
#define IS_REVERSE ((SEGMENT.options & REVERSE ) == REVERSE )
|
||||
#define IS_SELECTED ((SEGMENT.options & SELECTED) == SELECTED )
|
||||
|
||||
#define MODE_COUNT 97
|
||||
#define MODE_COUNT 98
|
||||
|
||||
#define FX_MODE_STATIC 0
|
||||
#define FX_MODE_BLINK 1
|
||||
@ -190,6 +190,7 @@
|
||||
#define FX_MODE_SINELON_RAINBOW 94
|
||||
#define FX_MODE_POPCORN 95
|
||||
#define FX_MODE_DRIP 96
|
||||
#define FX_MODE_PLASMA 97
|
||||
|
||||
|
||||
class WS2812FX {
|
||||
@ -376,6 +377,7 @@ class WS2812FX {
|
||||
_mode[FX_MODE_SINELON_RAINBOW] = &WS2812FX::mode_sinelon_rainbow;
|
||||
_mode[FX_MODE_POPCORN] = &WS2812FX::mode_popcorn;
|
||||
_mode[FX_MODE_DRIP] = &WS2812FX::mode_drip;
|
||||
_mode[FX_MODE_PLASMA] = &WS2812FX::mode_plasma;
|
||||
|
||||
_brightness = DEFAULT_BRIGHTNESS;
|
||||
currentPalette = CRGBPalette16(CRGB::Black);
|
||||
@ -557,7 +559,8 @@ class WS2812FX {
|
||||
mode_sinelon_dual(void),
|
||||
mode_sinelon_rainbow(void),
|
||||
mode_popcorn(void),
|
||||
mode_drip(void);
|
||||
mode_drip(void),
|
||||
mode_plasma(void);
|
||||
|
||||
|
||||
private:
|
||||
@ -637,7 +640,7 @@ const char JSON_mode_names[] PROGMEM = R"=====([
|
||||
"Scanner Dual","Stream 2","Oscillate","Pride 2015","Juggle","Palette","Fire 2012","Colorwaves","Bpm","Fill Noise",
|
||||
"Noise 1","Noise 2","Noise 3","Noise 4","Colortwinkles","Lake","Meteor","Meteor Smooth","Railway","Ripple",
|
||||
"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"
|
||||
"Fireworks 1D","Bouncing Balls","Sinelon","Sinelon Dual","Sinelon Rainbow","Popcorn","Drip","Plasma"
|
||||
])=====";
|
||||
|
||||
|
||||
|
@ -90,7 +90,7 @@
|
||||
#endif
|
||||
|
||||
//version code in format yymmddb (b = daily build)
|
||||
#define VERSION 2001151
|
||||
#define VERSION 2001191
|
||||
|
||||
char versionString[] = "0.9.0-b2";
|
||||
|
||||
|
@ -53,7 +53,9 @@ char* XML_response(AsyncWebServerRequest *request, char* dest = nullptr)
|
||||
}
|
||||
oappend("</wv><ws>");
|
||||
oappendi(colSec[3]);
|
||||
oappend("</ws><cy>");
|
||||
oappend("</ws><ps>");
|
||||
oappendi((currentPreset < 1) ? 0:currentPreset);
|
||||
oappend("</ps><cy>");
|
||||
oappendi(presetCyclingEnabled);
|
||||
oappend("</cy><ds>");
|
||||
if (realtimeActive)
|
||||
|
@ -377,11 +377,14 @@ bool handleSet(AsyncWebServerRequest *request, const String& req)
|
||||
if (t < strip.getMaxSegments()) main = t;
|
||||
}
|
||||
|
||||
WS2812FX::Segment& mainseg = strip.getSegment(main);
|
||||
pos = req.indexOf("SV="); //segment selected
|
||||
if (pos > 0) strip.getSegment(main).setOption(0, (req.charAt(pos+3) != '0'));
|
||||
if (pos > 0) mainseg.setOption(0, (req.charAt(pos+3) != '0'));
|
||||
|
||||
uint16_t startI = strip.getSegment(main).start;
|
||||
uint16_t stopI = strip.getSegment(main).stop;
|
||||
uint16_t startI = mainseg.start;
|
||||
uint16_t stopI = mainseg.stop;
|
||||
uint8_t grpI = mainseg.grouping;
|
||||
uint16_t spcI = mainseg.spacing;
|
||||
pos = req.indexOf("&S="); //segment start
|
||||
if (pos > 0) {
|
||||
startI = getNumVal(&req, pos);
|
||||
@ -390,7 +393,16 @@ bool handleSet(AsyncWebServerRequest *request, const String& req)
|
||||
if (pos > 0) {
|
||||
stopI = getNumVal(&req, pos);
|
||||
}
|
||||
strip.setSegment(main, startI, stopI);
|
||||
pos = req.indexOf("GP="); //segment grouping
|
||||
if (pos > 0) {
|
||||
grpI = getNumVal(&req, pos);
|
||||
if (grpI == 0) grpI = 1;
|
||||
}
|
||||
pos = req.indexOf("SP="); //segment spacing
|
||||
if (pos > 0) {
|
||||
spcI = getNumVal(&req, pos);
|
||||
}
|
||||
strip.setSegment(main, startI, stopI, grpI, spcI);
|
||||
|
||||
main = strip.getMainSegmentId();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user