diff --git a/wled00/WS2812FX.cpp b/wled00/WS2812FX.cpp index f43711034..1e935a80c 100644 --- a/wled00/WS2812FX.cpp +++ b/wled00/WS2812FX.cpp @@ -889,6 +889,7 @@ uint16_t WS2812FX::mode_merry_christmas(void) { return running(RED, GREEN); } + /* * Alternating orange/purple pixels running. */ @@ -910,7 +911,11 @@ uint16_t WS2812FX::mode_running_random(void) { setPixelColor(SEGMENT.start, color_wheel(SEGMENT_RUNTIME.aux_param)); } - SEGMENT_RUNTIME.counter_mode_step = (SEGMENT_RUNTIME.counter_mode_step == 0) ? 1 : 0; + SEGMENT_RUNTIME.counter_mode_step++; + if (SEGMENT_RUNTIME.counter_mode_step > ((255-SEGMENT.intensity) >> 4)) + { + SEGMENT_RUNTIME.counter_mode_step = 0; + } return SPEED_FORMULA_L; } @@ -976,7 +981,6 @@ uint16_t WS2812FX::fireworks(uint32_t color) { } } } - return SPEED_FORMULA_L; } @@ -1464,12 +1468,12 @@ uint16_t WS2812FX::mode_random_chase(void) setPixelColor(i, getPixelColor(i-1)); } uint32_t color = getPixelColor(SEGMENT.start + 1); - int r = random8(6) != 0 ? (color >> 16 & 0xFF) : random8(); - int g = random8(6) != 0 ? (color >> 8 & 0xFF) : random8(); - int b = random8(6) != 0 ? (color & 0xFF) : random8(); + uint8_t r = random8(6) != 0 ? (color >> 16 & 0xFF) : random8(); + uint8_t g = random8(6) != 0 ? (color >> 8 & 0xFF) : random8(); + uint8_t b = random8(6) != 0 ? (color & 0xFF) : random8(); setPixelColor(SEGMENT.start, r, g, b); - return 10 + (uint16_t)(255 - SEGMENT.speed); + return SPEED_FORMULA_L; } typedef struct Oscillator { @@ -1731,11 +1735,7 @@ uint16_t WS2812FX::mode_colorwaves(void) uint8_t bri8 = (uint32_t)(((uint32_t)bri16) * brightdepth) / 65536; bri8 += (255 - brightdepth); - uint8_t index = hue8; - //index = triwave8( index); - index = scale8( index, 240); - - CRGB newcolor = ColorFromPalette(currentPalette, index, bri8); + CRGB newcolor = ColorFromPalette(currentPalette, hue8, bri8); fastled_col = fastled_from_col(getPixelColor(i)); nblend(fastled_col, newcolor, 128); diff --git a/wled00/WS2812FX.h b/wled00/WS2812FX.h index 91d8adc7d..b8be9731c 100644 --- a/wled00/WS2812FX.h +++ b/wled00/WS2812FX.h @@ -494,4 +494,139 @@ class WS2812FX { segment_runtime _segment_runtimes[MAX_NUM_SEGMENTS]; // SRAM footprint: 17 bytes per element }; + +const char JSON_mode_names[] PROGMEM = R"=====({"effects":[ +"Solid", +"Blink", +"Breathe", +"Wipe", +"Wipe Random", +"Random Colors", +"Sweep", +"Dynamic", +"Colorloop", +"Rainbow", +"Scan", +"Dual Scan", +"Fade", +"Chase", +"Chase Rainbow", +"Running", +"Saw", +"Twinkle", +"Dissolve", +"Dissolve Rnd", +"Sparkle", +"Dark Sparkle", +"Sparkle+", +"Strobe", +"Strobe Rainbow", +"Mega Strobe", +"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", +"Scanner", +"Lighthouse", +"Fireworks", +"Fireworks Rnd", +"Merry Christmas", +"Fire Flicker", +"Gradient", +"Loading", +"In Out", +"In In", +"Out Out", +"Out In", +"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", +"Noise 1", +"Noise 2", +"Noise 3", +"Noise 4", +"Colortwinkle", +"Lake", +"Meteor", +"Smooth Meteor", +"Railway", +"Ripple" +]})====="; + + +const char JSON_palette_names[] PROGMEM = R"=====({"palettes":[ +"Default", +"Random Cycle", +"Primary Color", +"Based on Primary", +"Set Colors", +"Based on Set", +"Party", +"Cloud", +"Lava", +"Ocean", +"Forest", +"Rainbow", +"Rainbow Bands", +"Sunset", +"Rivendell", +"Breeze", +"Red & Blue", +"Yellowout", +"Analogous", +"Splash", +"Pastel", +"Sunset 2", +"Beech", +"Vintage", +"Departure", +"Landscape", +"Beach", +"Sherbet", +"Hult", +"Hult 64", +"Drywet", +"Jul", +"Grintage", +"Rewhi", +"Tertiary", +"Fire", +"Icefire", +"Cyane", +"Light Pink", +"Autumn", +"Magenta", +"Magred", +"Yelmag", +"Yelblu", +"Orange & Teal", +"Tiamat", +"April Night" +]})====="; + #endif diff --git a/wled00/WS2812FX_fcn.cpp b/wled00/WS2812FX_fcn.cpp index a5cee2c76..47652c354 100644 --- a/wled00/WS2812FX_fcn.cpp +++ b/wled00/WS2812FX_fcn.cpp @@ -29,8 +29,6 @@ #define LED_SKIP_AMOUNT 1 -#define LED_SKIP_AMOUNT 1 - void WS2812FX::init(bool supportWhite, uint16_t countPixels, bool skipFirst) { if (supportWhite == _rgbwMode && countPixels == _length && _locked != NULL) return; diff --git a/wled00/data/index.htm b/wled00/data/index.htm index 0cb366fbe..a80fd1965 100644 --- a/wled00/data/index.htm +++ b/wled00/data/index.htm @@ -38,8 +38,10 @@ var w=window.getComputedStyle(d.querySelector("html")); UCol(); CV(0); - setInterval('GIO()', 5000); + setInterval(GIO, 5000); GIO(); + setTimeout(function(){fillfx(0);}, 500); + setTimeout(function(){fillfx(1);}, 750); } function GIO() { @@ -356,6 +358,29 @@ { resp+="&PL=0";GIO(); } + function fillfx(fp) + { + e=""; + el = fp?Cf.FP:Cf.TX; + fetch(fp?'/json/palettes':'/json/effects') + .then(res => { + if (!res.ok) { + el.innerHTML=e; + } + return res.json(); + }) + .then(json => { + var x=""; + var l=fp?json.palettes:json.effects; + for (i in l) { + x += ""; + } + el.innerHTML=x; + }) + .catch(function () { + el.innerHTML=e; + }) + } +const char PAGE_msg1[] PROGMEM = R"=====(button{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:.3ch solid var(--bCol);display:inline-block;filter:drop-shadow(-5px -5px 5px var(--sCol));font-size:20px;margin:8px;margin-top:12px}body{font-family:var(--cFn),sans-serif;text-align:center;background:var(--cCol);color:var(--tCol);line-height:200%;margin:0;background-attachment:fixed} -
-)====="; +)====="; //new user welcome page #ifndef WLED_DISABLE_MOBILE_UI -const char PAGE_welcome0[] PROGMEM = R"=====( - +const char PAGE_welcome0[] PROGMEM = R"=====( -