diff --git a/wled00/WS2812FX.cpp b/wled00/WS2812FX.cpp index 34b30440..fa567421 100644 --- a/wled00/WS2812FX.cpp +++ b/wled00/WS2812FX.cpp @@ -1667,6 +1667,11 @@ uint16_t WS2812FX::mode_circus_combustus(void) { */ uint16_t WS2812FX::mode_icu(void) { uint16_t dest = SEGMENT_RUNTIME.counter_mode_step & 0xFFFF; + + for (uint16_t i = SEGMENT.start; i <= SEGMENT.stop; i++) + { + setPixelColor(i, SEGMENT.colors[1]); + } setPixelColor(SEGMENT.start + dest, SEGMENT.colors[0]); setPixelColor(SEGMENT.start + dest + SEGMENT_LENGTH/2, SEGMENT.colors[0]); @@ -1973,12 +1978,62 @@ uint16_t WS2812FX::mode_fire_2012(void) } +// Pride2015 +// Animated, ever-changing rainbows. +// by Mark Kriegsman: https://gist.github.com/kriegsman/964de772d64c502760e5 +uint16_t WS2812FX::mode_pride_2015(void) +{ + uint16_t duration = 10 + SEGMENT.speed; + uint16_t sPseudotime = SEGMENT_RUNTIME.counter_mode_step; + uint16_t sHue16 = SEGMENT_RUNTIME.aux_param; + + uint8_t sat8 = beatsin88( 87, 220, 250); + uint8_t brightdepth = beatsin88( 341, 96, 224); + uint16_t brightnessthetainc16 = beatsin88( 203, (25 * 256), (40 * 256)); + uint8_t msmultiplier = beatsin88(147, 23, 60); + + uint16_t hue16 = sHue16;//gHue * 256; + uint16_t hueinc16 = beatsin88(113, 1, 3000); + + sPseudotime += duration * msmultiplier; + sHue16 += duration * beatsin88( 400, 5,9); + uint16_t brightnesstheta16 = sPseudotime; + CRGB fastled_col; + + for( uint16_t i = SEGMENT.start ; i <= SEGMENT.stop; i++) { + hue16 += hueinc16; + uint8_t hue8 = hue16 >> 8; + + brightnesstheta16 += brightnessthetainc16; + uint16_t b16 = sin16( brightnesstheta16 ) + 32768; + + uint16_t bri16 = (uint32_t)((uint32_t)b16 * (uint32_t)b16) / 65536; + uint8_t bri8 = (uint32_t)(((uint32_t)bri16) * brightdepth) / 65536; + bri8 += (255 - brightdepth); + + CRGB newcolor = CHSV( hue8, sat8, bri8); + + uint32_t color = getPixelColor(i); + fastled_col.red = (color >> 16 & 0xFF); + fastled_col.green = (color >> 8 & 0xFF); + fastled_col.blue = (color & 0xFF); + + nblend( fastled_col, newcolor, 64); + setPixelColor(i, fastled_col.red, fastled_col.green, fastled_col.blue); + } + SEGMENT_RUNTIME.counter_mode_step = sPseudotime; + SEGMENT_RUNTIME.aux_param = sHue16; + return 20; +} + + +// eight colored dots, weaving in and out of sync with each other uint16_t WS2812FX::mode_juggle(void){ fade_out((255-SEGMENT.intensity) / 32); CRGB fastled_col; byte dothue = 0; for ( byte i = 0; i < 8; i++) { - uint16_t index = SEGMENT.start + beatsin16(i + 7, 0, SEGMENT_LENGTH); + uint16_t index = SEGMENT.start + beatsin16(i + 7, 0, SEGMENT_LENGTH -1); uint32_t color = getPixelColor(index); fastled_col.red = (color >> 16 & 0xFF); fastled_col.green = (color >> 8 & 0xFF); @@ -1990,6 +2045,7 @@ uint16_t WS2812FX::mode_juggle(void){ return 10 + (uint16_t)(255 - SEGMENT.speed)/4; } + /* * FastLED palette modes helper function. Limitation: Due to memory reasons, multiple active segments with FastLED will disable the Palette transitions */ @@ -2081,7 +2137,7 @@ void WS2812FX::handle_palette(void) targetPalette = PartyColors_p; break; } - if (singleSegmentMode) //only blend if just one segment uses FastLED mode + if (singleSegmentMode && paletteFade) //only blend if just one segment uses FastLED mode { nblendPaletteTowardPalette(currentPalette, targetPalette, 42); } else @@ -2107,6 +2163,66 @@ uint16_t WS2812FX::mode_palette(void) } +// ColorWavesWithPalettes by Mark Kriegsman: https://gist.github.com/kriegsman/8281905786e8b2632aeb +// This function draws color waves with an ever-changing, +// widely-varying set of parameters, using a color palette. +uint16_t WS2812FX::mode_colorwaves(void) +{ + handle_palette(); + uint16_t duration = 10 + SEGMENT.speed; + uint16_t sPseudotime = SEGMENT_RUNTIME.counter_mode_step; + uint16_t sHue16 = SEGMENT_RUNTIME.aux_param; + + uint8_t brightdepth = beatsin88( 341, 96, 224); + uint16_t brightnessthetainc16 = beatsin88( 203, (25 * 256), (40 * 256)); + uint8_t msmultiplier = beatsin88(147, 23, 60); + + uint16_t hue16 = sHue16;//gHue * 256; + uint16_t hueinc16 = beatsin88(113, 300, 1500); + + sPseudotime += duration * msmultiplier; + sHue16 += duration * beatsin88( 400, 5, 9); + uint16_t brightnesstheta16 = sPseudotime; + CRGB fastled_col; + + for ( uint16_t i = SEGMENT.start ; i <= SEGMENT.stop; i++) { + hue16 += hueinc16; + uint8_t hue8 = hue16 / 256; + uint16_t h16_128 = hue16 >> 7; + if ( h16_128 & 0x100) { + hue8 = 255 - (h16_128 >> 1); + } else { + hue8 = h16_128 >> 1; + } + + brightnesstheta16 += brightnessthetainc16; + uint16_t b16 = sin16( brightnesstheta16 ) + 32768; + + uint16_t bri16 = (uint32_t)((uint32_t)b16 * (uint32_t)b16) / 65536; + 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); + + uint32_t color = getPixelColor(i); + fastled_col.red = (color >> 16 & 0xFF); + fastled_col.green = (color >> 8 & 0xFF); + fastled_col.blue = (color & 0xFF); + + nblend(fastled_col, newcolor, 128); + setPixelColor(i, fastled_col.red, fastled_col.green, fastled_col.blue); + } + SEGMENT_RUNTIME.counter_mode_step = sPseudotime; + SEGMENT_RUNTIME.aux_param = sHue16; + return 20; +} + + +// colored stripes pulsing at a defined Beats-Per-Minute (BPM) uint16_t WS2812FX::mode_bpm(void) { handle_palette(); @@ -2137,23 +2253,22 @@ uint16_t WS2812FX::mode_fillnoise8(void) return 20; } - uint16_t WS2812FX::mode_noise16_1(void) { - uint16_t scale = 750; // the "zoom factor" for the noise + uint16_t scale = 320; // the "zoom factor" for the noise handle_palette(); CRGB fastled_col; SEGMENT_RUNTIME.counter_mode_step += (1 + SEGMENT.speed/16); for (int i = SEGMENT.start; i <= SEGMENT.stop; i++) { - uint16_t shift_x = beatsin8(5); // the x position of the noise field swings @ 17 bpm - uint16_t shift_y = SEGMENT_RUNTIME.counter_mode_step/50; // the y position becomes slowly incremented + uint16_t shift_x = beatsin8(11); // the x position of the noise field swings @ 17 bpm + uint16_t shift_y = SEGMENT_RUNTIME.counter_mode_step/42; // the y position becomes slowly incremented uint16_t real_x = (i + shift_x) * scale; // the x position of the noise field swings @ 17 bpm uint16_t real_y = (i + shift_y) * scale; // the y position becomes slowly incremented - uint32_t real_z = SEGMENT_RUNTIME.counter_mode_step*2; // the z position becomes quickly incremented + uint32_t real_z = SEGMENT_RUNTIME.counter_mode_step; // the z position becomes quickly incremented uint8_t noise = inoise16(real_x, real_y, real_z) >> 8; // get the noise data and scale it down @@ -2169,21 +2284,21 @@ uint16_t WS2812FX::mode_noise16_1(void) uint16_t WS2812FX::mode_noise16_2(void) { - uint8_t scale = 750; // the "zoom factor" for the noise + uint16_t scale = 1000; // the "zoom factor" for the noise handle_palette(); CRGB fastled_col; SEGMENT_RUNTIME.counter_mode_step += (1 + SEGMENT.speed); for (int i = SEGMENT.start; i <= SEGMENT.stop; i++) { - uint16_t shift_x = SEGMENT_RUNTIME.counter_mode_step/64; // x as a function of time - uint16_t shift_y = 0; + uint16_t shift_x = SEGMENT_RUNTIME.counter_mode_step >> 6; // x as a function of time + uint16_t shift_y = SEGMENT_RUNTIME.counter_mode_step/42; uint32_t real_x = (i + shift_x) * scale; // calculate the coordinates within the noise field uint32_t real_y = (i + shift_y) * scale; // based on the precalculated positions uint32_t real_z = 4223; - uint8_t noise = inoise16(real_x, real_y, real_z) >> 8; // get the noise data and scale it down + uint8_t noise = inoise16(real_x, 0, 4223) >> 8; // get the noise data and scale it down uint8_t index = sin8(noise * 3); // map led color based on noise data @@ -2197,7 +2312,7 @@ uint16_t WS2812FX::mode_noise16_2(void) uint16_t WS2812FX::mode_noise16_3(void) { - uint8_t scale = 750; // the "zoom factor" for the noise + uint16_t scale = 800; // the "zoom factor" for the noise handle_palette(); CRGB fastled_col; SEGMENT_RUNTIME.counter_mode_step += (1 + SEGMENT.speed); @@ -2209,9 +2324,9 @@ uint16_t WS2812FX::mode_noise16_3(void) uint32_t real_x = (i + shift_x) * scale; // calculate the coordinates within the noise field uint32_t real_y = (i + shift_y) * scale; // based on the precalculated positions - uint32_t real_z = SEGMENT_RUNTIME.counter_mode_step/16; + uint32_t real_z = SEGMENT_RUNTIME.counter_mode_step*8; - uint8_t noise = inoise16(real_x, real_y, real_z) >> 7; // get the noise data and scale it down + uint8_t noise = inoise16(real_x, real_y, real_z) >> 8; // get the noise data and scale it down uint8_t index = sin8(noise * 3); // map led color based on noise data diff --git a/wled00/WS2812FX.h b/wled00/WS2812FX.h index 36f613fa..4c18e694 100644 --- a/wled00/WS2812FX.h +++ b/wled00/WS2812FX.h @@ -82,7 +82,7 @@ #define REVERSE (uint8_t)0x80 #define IS_REVERSE ((SEGMENT.options & REVERSE) == REVERSE) -#define MODE_COUNT 72 +#define MODE_COUNT 74 #define FX_MODE_STATIC 0 #define FX_MODE_BLINK 1 @@ -147,15 +147,18 @@ #define FX_MODE_DUAL_LARSON_SCANNER 60 #define FX_MODE_RANDOM_CHASE 61 #define FX_MODE_OSCILLATE 62 +//Modes that use FastLED --> #define FX_MODE_FIRE_2012 63 -#define FX_MODE_JUGGLE 64 -#define FX_MODE_PALETTE 65 -#define FX_MODE_BPM 66 -#define FX_MODE_FILLNOISE8 67 -#define FX_MODE_NOISE16_1 68 -#define FX_MODE_NOISE16_2 69 -#define FX_MODE_NOISE16_3 70 -#define FX_MODE_NOISE16_4 71 +#define FX_MODE_PRIDE_2015 64 +#define FX_MODE_JUGGLE 65 +#define FX_MODE_PALETTE 66 +#define FX_MODE_COLORWAVES 67 +#define FX_MODE_BPM 68 +#define FX_MODE_FILLNOISE8 69 +#define FX_MODE_NOISE16_1 70 +#define FX_MODE_NOISE16_2 71 +#define FX_MODE_NOISE16_3 72 +#define FX_MODE_NOISE16_4 73 class WS2812FX { typedef uint16_t (WS2812FX::*mode_ptr)(void); @@ -248,9 +251,11 @@ class WS2812FX { _mode[FX_MODE_RANDOM_CHASE] = &WS2812FX::mode_random_chase; _mode[FX_MODE_OSCILLATE] = &WS2812FX::mode_oscillate; _mode[FX_MODE_FIRE_2012] = &WS2812FX::mode_fire_2012; + _mode[FX_MODE_PRIDE_2015] = &WS2812FX::mode_pride_2015; _mode[FX_MODE_BPM] = &WS2812FX::mode_bpm; _mode[FX_MODE_JUGGLE] = &WS2812FX::mode_juggle; _mode[FX_MODE_PALETTE] = &WS2812FX::mode_palette; + _mode[FX_MODE_COLORWAVES] = &WS2812FX::mode_colorwaves; _mode[FX_MODE_FILLNOISE8] = &WS2812FX::mode_fillnoise8; _mode[FX_MODE_NOISE16_1] = &WS2812FX::mode_noise16_1; _mode[FX_MODE_NOISE16_2] = &WS2812FX::mode_noise16_2; @@ -326,6 +331,8 @@ class WS2812FX { getPowerEstimate(uint16_t leds, uint32_t c, byte b), getSafePowerMultiplier(double safeMilliAmps, uint16_t leds, uint32_t c, byte b); + bool paletteFade; + WS2812FX::Segment getSegment(void); @@ -413,9 +420,11 @@ class WS2812FX { mode_random_chase(void), mode_oscillate(void), mode_fire_2012(void), + mode_pride_2015(void), mode_bpm(void), mode_juggle(void), mode_palette(void), + mode_colorwaves(void), mode_fillnoise8(void), mode_noise16_1(void), mode_noise16_2(void), diff --git a/wled00/data/index.htm b/wled00/data/index.htm index e3f3cb89..b53bebc0 100644 --- a/wled00/data/index.htm +++ b/wled00/data/index.htm @@ -171,8 +171,8 @@ case 3: gId("path1").style.fill = aC; gId("path2").style.fill = aC; } tgb.style.fill=(Cf.SA.value>0)?aC:dC; - fpX.style.display=(Cf.TX.selectedIndex>64)?"block":"none"; - fof.style.fill=(Cf.TX.selectedIndex>64)?aC:dC; + fpX.style.display=(Cf.TX.selectedIndex>65)?"block":"none"; + fof.style.fill=(Cf.TX.selectedIndex>65)?aC:dC; fmr.style.fill=(Cf.TX.selectedIndex<1)?aC:dC; } function TgT() @@ -191,10 +191,10 @@ function SwFX(s) { var n=Cf.TX.selectedIndex+s; - if (n==-1||n==72) return; + if (n==-1||n==74) return; Cf.TX.selectedIndex =n; if (n < 0) Cf.TX.selectedIndex = 0; - if (n > 71) Cf.TX.selectedIndex = 65; + if (n > 73) Cf.TX.selectedIndex = 66; GX(); } function TgHSB() @@ -649,14 +649,16 @@ - - - - - - - - + + + + + + + + + +

Set secondary color to diff --git a/wled00/data/index_mobile.htm b/wled00/data/index_mobile.htm index 98b03a43..b040e957 100644 --- a/wled00/data/index_mobile.htm +++ b/wled00/data/index_mobile.htm @@ -7,7 +7,7 @@ - WLED 0.7.1 + WLED 0.8.0-a
Loading WLED UI...

WLED

FX 2nd Color

Sync Lights

White Channel

Master Brightness



 
 
 
 

 
 
 
 

Edit Presets

Presets

1
2
3
4

5
6
7
8

9
10
11
12

13
14
15
16

Cycle Mode

Cycle Range

Preset Duration

Color Transition

FX Speed

FX Intensity

+ + + +WLED 0.8.0-a + )====="; //head1 (css) @@ -97,21 +119,108 @@ const char PAGE_index3[] PROGMEM = R"=====( -
-
-
-
-
-
-
-
-
+ +
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Effect Panel



- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Set secondary color to @@ -119,12 +228,30 @@ Set secondary color to -or
+or +

FastLED Palette

-
-
-
+ +
+
+
+
+
+
+
Favorite Presets

@@ -133,13 +260,21 @@ Favorite Presets




Click checkmark to apply brightness, color and effects.

Cycle through presets to , keep each for ms:

-
+
+
+
Timed Light



Gradually dim down
-1st slider sets duration (1-255min), 2nd sets target brightness.
-
-
-
- +1st slider sets duration (1-255min), 2nd sets target brightness. +
+
+
+
+
+
+ + + + )====="; diff --git a/wled00/htmls01.h b/wled00/htmls01.h index ab67d9db..c5d08aa8 100644 --- a/wled00/htmls01.h +++ b/wled00/htmls01.h @@ -112,7 +112,8 @@ Brightness factor: %

Transitions

Fade:
Transition Time: ms
-Enable transition for secondary color:
+Enable transition for secondary color: +Enable Palette transitions:

Timed light

Default Duration: min
Default Target brightness:
diff --git a/wled00/wled00.ino b/wled00/wled00.ino index 7a7342c9..8209d3e1 100644 --- a/wled00/wled00.ino +++ b/wled00/wled00.ino @@ -39,7 +39,7 @@ #include "src/dependencies/e131/E131.h" //version in format yymmddb (b = daily build) -#define VERSION 1809062 +#define VERSION 1809081 char versionString[] = "0.8.0-a"; //AP and OTA default passwords (change them!) diff --git a/wled00/wled01_eeprom.ino b/wled00/wled01_eeprom.ino index 8ad3e524..357d4647 100644 --- a/wled00/wled01_eeprom.ino +++ b/wled00/wled01_eeprom.ino @@ -121,7 +121,7 @@ void saveSettingsToEEPROM() EEPROM.write(371, whiteS); EEPROM.write(372, useRGBW); EEPROM.write(373, effectPaletteDefault); - + EEPROM.write(374, strip.paletteFade); EEPROM.write(375, apWaitTimeSecs); EEPROM.write(376, recoveryAPDisabled); EEPROM.write(377, EEPVER); //eeprom was updated to latest @@ -356,6 +356,7 @@ void loadSettingsFromEEPROM(bool first) whiteS = EEPROM.read(371); white = whiteS; useRGBW = EEPROM.read(372); effectPaletteDefault = EEPROM.read(373); effectPalette = effectPaletteDefault; + strip.paletteFade = EEPROM.read(374); if (lastEEPROMversion > 0) { apWaitTimeSecs = EEPROM.read(375); diff --git a/wled00/wled02_xml.ino b/wled00/wled02_xml.ino index 440aca3d..d8b1a7e9 100644 --- a/wled00/wled02_xml.ino +++ b/wled00/wled02_xml.ino @@ -192,6 +192,7 @@ void getSettingsJS(byte subPage) //get values for settings form in javascript sappend('c',"GC",useGammaCorrectionRGB); sappend('c',"TF",fadeTransition); sappend('v',"TD",transitionDelay); + sappend('c',"PF",strip.paletteFade); sappend('c',"T2",!disableSecTransition); sappend('v',"BF",briMultiplier); sappend('v',"TB",nightlightTargetBri); diff --git a/wled00/wled03_set.ino b/wled00/wled03_set.ino index 0dfcf063..6a237b84 100644 --- a/wled00/wled03_set.ino +++ b/wled00/wled03_set.ino @@ -171,6 +171,7 @@ void handleSettingsSet(byte subPage) transitionDelay = i; } } + strip.paletteFade = server.hasArg("PF"); disableSecTransition = !server.hasArg("T2"); if (server.hasArg("TB")) { diff --git a/wled00/wled05_init.ino b/wled00/wled05_init.ino index 29e17354..dfb778f6 100644 --- a/wled00/wled05_init.ino +++ b/wled00/wled05_init.ino @@ -5,7 +5,7 @@ void wledInit() { EEPROM.begin(EEPSIZE); - showWelcomePage = (EEPROM.read(233) != 233); + if (EEPROM.read(233) != 233) showWelcomePage = true; ledCount = ((EEPROM.read(229) << 0) & 0xFF) + ((EEPROM.read(398) << 8) & 0xFF00); if (ledCount > 1200 || ledCount == 0) ledCount = 10; //RMT eats up too much RAM #ifdef ARDUINO_ARCH_ESP32