diff --git a/platformio.ini b/platformio.ini index 84200955..dd9bb0bc 100644 --- a/platformio.ini +++ b/platformio.ini @@ -80,6 +80,7 @@ arduino_core_2_6_2 = espressif8266@2.3.1 arduino_core_stage = https://github.com/platformio/platform-espressif8266.git#feature/stage platform = ${common:esp8266.arduino_core_2_6_2} build_flags = + -D ESP8266 -D PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH -Wl,-Teagle.flash.4m1m.ld ;;;; Required for core > v2.5.0 or staging version 4MB Flash 3MB SPIFFs @@ -127,6 +128,8 @@ build_flags = ${common:esp8266.build_flags} lib_deps = ${common.lib_deps_external} +lib_compat_mode = strict +lib_ignore = AsynTCP [env:d1_mini] board = d1_mini @@ -139,6 +142,8 @@ build_flags = ${common:esp8266.build_flags} lib_deps = ${common.lib_deps_external} +lib_compat_mode = strict +lib_ignore = AsynTCP [env:esp01_1m] board = esp01_1m @@ -153,6 +158,8 @@ build_flags = -D WLED_DISABLE_INFRARED lib_deps = ${common.lib_deps_external} +lib_compat_mode = strict +lib_ignore = AsynTCP [env:esp01] board = esp01 @@ -166,6 +173,8 @@ build_flags = -D WLED_DISABLE_INFRARED lib_deps = ${common.lib_deps_external} +lib_compat_mode = strict +lib_ignore = AsynTCP [env:esp07] board = esp07 @@ -178,6 +187,8 @@ build_flags = ${common:esp8266.build_flags} lib_deps = ${common.lib_deps_external} +lib_compat_mode = strict +lib_ignore = AsynTCP # see: http://docs.platformio.org/en/latest/platforms/espressif32.html [env:esp32dev] @@ -193,6 +204,7 @@ lib_deps = ${common.lib_deps_external} lib_ignore = ESPAsyncUDP +lib_compat_mode = strict [env:esp8285_4CH_MagicHome] board = esp8285 @@ -207,6 +219,8 @@ build_flags = -D WLED_USE_ANALOG_LEDS lib_deps = ${common.lib_deps_external} +lib_compat_mode = strict +lib_ignore = AsynTCP [env:esp8285_4CH_H801] board = esp8285 @@ -222,6 +236,8 @@ build_flags = -D WLED_USE_H801 lib_deps = ${common.lib_deps_external} +lib_compat_mode = strict +lib_ignore = AsynTCP [env:esp8285_5CH_H801] board = esp8285 @@ -238,4 +254,6 @@ build_flags = -D WLED_ENABLE_5CH_LEDS lib_deps = ${common.lib_deps_external} +lib_compat_mode = strict +lib_ignore = AsynTCP diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 479714fe..eb043522 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -1219,11 +1219,10 @@ uint16_t WS2812FX::mode_loading(void) { //American Police Light with all LEDs Red and Blue -uint16_t WS2812FX::police_base(uint32_t color1, uint32_t color2) +uint16_t WS2812FX::police_base(uint32_t color1, uint32_t color2, bool all) { uint16_t counter = now * ((SEGMENT.speed >> 2) +1); uint16_t idexR = (counter * SEGLEN) >> 16; - uint8_t size = 1 + SEGMENT.intensity >> 3; if (idexR >= SEGLEN) idexR = 0; uint16_t topindex = SEGLEN >> 1; @@ -1231,19 +1230,31 @@ uint16_t WS2812FX::police_base(uint32_t color1, uint32_t color2) if (SEGENV.call == 0) SEGENV.aux0 = idexR; if (idexB >= SEGLEN) idexB = 0; //otherwise overflow on odd number of LEDs - for (uint8_t i=0; i <= size; i++) { - setPixelColor(idexR+i, color1); - setPixelColor(idexB+i, color2); - } - if (SEGENV.aux0 != idexR) { - uint8_t gap = (SEGENV.aux0 < idexR)? idexR - SEGENV.aux0:SEGLEN - SEGENV.aux0 + idexR; - for (uint8_t i = 0; i <= gap ; i++) { - if ((idexR - i) < 0) idexR = SEGLEN-1 + i; - if ((idexB - i) < 0) idexB = SEGLEN-1 + i; - setPixelColor(idexR-i, color1); - setPixelColor(idexB-i, color2); + if (all) { //different algo, ensuring immediate fill + if (idexB > idexR) { + fill(color2); + for (uint16_t i = idexR; i < idexB; i++) setPixelColor(i, color1); + } else { + fill(color1); + for (uint16_t i = idexB; i < idexR; i++) setPixelColor(i, color2); + } + } else { //regular dot-only mode + uint8_t size = 1 + SEGMENT.intensity >> 3; + if (size > SEGLEN/2) size = 1+ SEGLEN/2; + for (uint8_t i=0; i <= size; i++) { + setPixelColor(idexR+i, color1); + setPixelColor(idexB+i, color2); + } + if (SEGENV.aux0 != idexR) { + uint8_t gap = (SEGENV.aux0 < idexR)? idexR - SEGENV.aux0:SEGLEN - SEGENV.aux0 + idexR; + for (uint8_t i = 0; i <= gap ; i++) { + if ((idexR - i) < 0) idexR = SEGLEN-1 + i; + if ((idexB - i) < 0) idexB = SEGLEN-1 + i; + setPixelColor(idexR-i, color1); + setPixelColor(idexB-i, color2); + } + SEGENV.aux0 = idexR; } - SEGENV.aux0 = idexR; } return FRAMETIME; @@ -1253,7 +1264,7 @@ uint16_t WS2812FX::police_base(uint32_t color1, uint32_t color2) //American Police Light with all LEDs Red and Blue uint16_t WS2812FX::mode_police_all() { - return police_base(RED, BLUE); + return police_base(RED, BLUE, true); } @@ -1262,14 +1273,14 @@ uint16_t WS2812FX::mode_police() { fill(SEGCOLOR(1)); - return police_base(RED, BLUE); + return police_base(RED, BLUE, false); } //Police All with custom colors uint16_t WS2812FX::mode_two_areas() { - return police_base(SEGCOLOR(0), SEGCOLOR(1)); + return police_base(SEGCOLOR(0), SEGCOLOR(1), true); } @@ -1279,7 +1290,7 @@ uint16_t WS2812FX::mode_two_dots() fill(SEGCOLOR(2)); uint32_t color2 = (SEGCOLOR(1) == SEGCOLOR(2)) ? SEGCOLOR(0) : SEGCOLOR(1); - return police_base(SEGCOLOR(0), color2); + return police_base(SEGCOLOR(0), color2, false); } @@ -1327,22 +1338,23 @@ uint16_t WS2812FX::mode_tricolor_chase(void) { */ uint16_t WS2812FX::mode_icu(void) { uint16_t dest = SEGENV.step & 0xFFFF; + uint8_t space = (SEGMENT.intensity >> 3) +2; fill(SEGCOLOR(1)); - byte pindex = map(dest, 0, SEGLEN/2, 0, 255); + byte pindex = map(dest, 0, SEGLEN-SEGLEN/space, 0, 255); uint32_t col = color_from_palette(pindex, false, false, 0); - setPixelColor( dest, col); - setPixelColor( dest + SEGLEN/2, col); + setPixelColor(dest, col); + setPixelColor(dest + SEGLEN/space, col); if(SEGENV.aux0 == dest) { // pause between eye movements if(random8(6) == 0) { // blink once in a while - setPixelColor( dest, SEGCOLOR(1)); - setPixelColor( dest + SEGLEN/2, SEGCOLOR(1)); + setPixelColor(dest, SEGCOLOR(1)); + setPixelColor(dest + SEGLEN/space, SEGCOLOR(1)); return 200; } - SEGENV.aux0 = random16(SEGLEN/2); + SEGENV.aux0 = random16(SEGLEN-SEGLEN/space); return 1000 + random16(2000); } @@ -1355,7 +1367,7 @@ uint16_t WS2812FX::mode_icu(void) { } setPixelColor(dest, col); - setPixelColor(dest + SEGLEN/2, col); + setPixelColor(dest + SEGLEN/space, col); return SPEED_FORMULA_L; } @@ -1451,13 +1463,14 @@ uint16_t WS2812FX::mode_tricolor_fade(void) */ uint16_t WS2812FX::mode_multi_comet(void) { - uint32_t cycleTime = 20 + (2 * (uint32_t)(255 - SEGMENT.speed)); + uint32_t cycleTime = 10 + (uint32_t)(255 - SEGMENT.speed); uint32_t it = now / cycleTime; if (SEGENV.step == it) return FRAMETIME; - + if (!SEGENV.allocateData(sizeof(uint16_t) * 8)) return mode_static(); //allocation failed + fade_out(SEGMENT.intensity); - - static uint16_t comets[] = {UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX}; + + uint16_t* comets = reinterpret_cast(SEGENV.data); for(uint8_t i=0; i < 8; i++) { if(comets[i] < SEGLEN) { @@ -1566,7 +1579,7 @@ uint16_t WS2812FX::mode_oscillate(void) uint32_t color = BLACK; for(uint8_t j=0; j < numOscillators; j++) { if(i >= oscillators[j].pos - oscillators[j].size && i <= oscillators[j].pos + oscillators[j].size) { - color = (color == BLACK) ? SEGMENT.colors[j] : color_blend(color, SEGMENT.colors[j], 128); + color = (color == BLACK) ? SEGCOLOR(j) : color_blend(color, SEGCOLOR(j), 128); } } setPixelColor(i, color); @@ -2133,7 +2146,7 @@ typedef struct Ripple { uint16_t pos; } ripple; -uint16_t WS2812FX::mode_ripple() +uint16_t WS2812FX::ripple_base(bool rainbow) { uint16_t maxRipples = 1 + (SEGLEN >> 2); if (maxRipples > 100) maxRipples = 100; @@ -2143,8 +2156,25 @@ uint16_t WS2812FX::mode_ripple() Ripple* ripples = reinterpret_cast(SEGENV.data); - fill(SEGCOLOR(1)); - + // ranbow background or chosen background, all very dim. + if (rainbow) { + if (SEGENV.call ==0) { + SEGENV.aux0 = random8(); + SEGENV.aux1 = random8(); + } + if (SEGENV.aux0 == SEGENV.aux1) { + SEGENV.aux1 = random8(); + } + else if (SEGENV.aux1 > SEGENV.aux0) { + SEGENV.aux0++; + } else { + SEGENV.aux0--; + } + fill(color_blend(color_wheel(SEGENV.aux0),BLACK,235)); + } else { + fill(SEGCOLOR(1)); + } + //draw wave for (uint16_t i = 0; i < maxRipples; i++) { @@ -2188,6 +2218,15 @@ uint16_t WS2812FX::mode_ripple() return FRAMETIME; } +uint16_t WS2812FX::mode_ripple(void) { + return ripple_base(false); +} + +uint16_t WS2812FX::mode_ripple_rainbow(void) { + return ripple_base(true); +} + + // TwinkleFOX by Mark Kriegsman: https://gist.github.com/kriegsman/756ea6dcae8e30845b5a // @@ -3060,8 +3099,8 @@ uint16_t WS2812FX::mode_percent(void) { uint16_t active_leds = (percent < 100) ? SEGLEN * percent / 100.0 : SEGLEN * (200 - percent) / 100.0; - if (SEGENV.call == 0) SEGENV.step = 0; - uint8_t size = (1 + ((SEGMENT.speed * SEGLEN) >> 11)) & 0xFF ; + uint8_t size = (1 + ((SEGMENT.speed * SEGLEN) >> 11)); + if (SEGMENT.speed == 255) size = 255; if (percent < 100) { for (uint16_t i = 0; i < SEGLEN; i++) { @@ -3092,4 +3131,34 @@ uint16_t WS2812FX::mode_percent(void) { } return FRAMETIME; +} + +/* +/ Modulates the brightness similar to a heartbeat +*/ +uint16_t WS2812FX::mode_heartbeat(void) { + uint8_t bpm = 40 + (SEGMENT.speed >> 4); + uint32_t msPerBeat = (60000 / bpm); + uint32_t secondBeat = (msPerBeat / 3); + + uint32_t bri_lower = SEGENV.aux1; + bri_lower = bri_lower * 2042 / (2048 + SEGMENT.intensity); + SEGENV.aux1 = bri_lower; + + unsigned long beatTimer = millis() - SEGENV.step; + if((beatTimer > secondBeat) && !SEGENV.aux0) { // time for the second beat? + SEGENV.aux1 = UINT16_MAX; //full bri + SEGENV.aux0 = 1; + } + if(beatTimer > msPerBeat) { // time to reset the beat timer? + SEGENV.aux1 = UINT16_MAX; //full bri + SEGENV.aux0 = 0; + SEGENV.step = millis(); + } + + for (uint16_t i = 0; i < SEGLEN; i++) { + setPixelColor(i, color_blend(color_from_palette(i, true, PALETTE_SOLID_WRAP, 0), SEGCOLOR(1), 255 - (SEGENV.aux1 >> 8))); + } + + return FRAMETIME; } \ No newline at end of file diff --git a/wled00/FX.h b/wled00/FX.h index d4bf4ff5..abfc11d3 100644 --- a/wled00/FX.h +++ b/wled00/FX.h @@ -91,7 +91,7 @@ #define IS_REVERSE ((SEGMENT.options & REVERSE ) == REVERSE ) #define IS_SELECTED ((SEGMENT.options & SELECTED) == SELECTED ) -#define MODE_COUNT 99 +#define MODE_COUNT 101 #define FX_MODE_STATIC 0 #define FX_MODE_BLINK 1 @@ -192,6 +192,8 @@ #define FX_MODE_DRIP 96 #define FX_MODE_PLASMA 97 #define FX_MODE_PERCENT 98 +#define FX_MODE_RIPPLE_RAINBOW 99 +#define FX_MODE_HEARTBEAT 100 class WS2812FX { typedef uint16_t (WS2812FX::*mode_ptr)(void); @@ -379,6 +381,8 @@ class WS2812FX { _mode[FX_MODE_DRIP] = &WS2812FX::mode_drip; _mode[FX_MODE_PLASMA] = &WS2812FX::mode_plasma; _mode[FX_MODE_PERCENT] = &WS2812FX::mode_percent; + _mode[FX_MODE_RIPPLE_RAINBOW] = &WS2812FX::mode_ripple_rainbow; + _mode[FX_MODE_HEARTBEAT] = &WS2812FX::mode_heartbeat; _brightness = DEFAULT_BRIGHTNESS; currentPalette = CRGBPalette16(CRGB::Black); @@ -562,7 +566,9 @@ class WS2812FX { mode_popcorn(void), mode_drip(void), mode_plasma(void), - mode_percent(void); + mode_percent(void), + mode_ripple_rainbow(void), + mode_heartbeat(void); private: @@ -607,7 +613,8 @@ class WS2812FX { dissolve(uint32_t), chase(uint32_t, uint32_t, uint32_t, bool), gradient_base(bool), - police_base(uint32_t, uint32_t), + ripple_base(bool), + police_base(uint32_t, uint32_t, bool), running(uint32_t, uint32_t), tricolor_chase(uint32_t, uint32_t), twinklefox_base(bool), @@ -642,7 +649,8 @@ 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","Plasma","Percent" +"Fireworks 1D","Bouncing Balls","Sinelon","Sinelon Dual","Sinelon Rainbow","Popcorn","Drip","Plasma","Percent","Ripple Rainbow", +"Heartbeat" ])====="; diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index 7c87a292..c1ee11af 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -125,9 +125,12 @@ void WS2812FX::setPixelColor(uint16_t i, byte r, byte g, byte b, byte w) /* Set all the pixels in the group, ensuring _skipFirstMode is honored */ bool reversed = reverseMode ^ IS_REVERSE; uint16_t realIndex = realPixelIndex(i); + for (uint16_t j = 0; j < SEGMENT.grouping; j++) { int16_t indexSet = realIndex + (reversed ? -j : j); - if (indexSet >= SEGMENT.start && indexSet < SEGMENT.stop) bus->SetPixelColor(indexSet + skip, col); + int16_t indexSetRev = indexSet; + if (reverseMode) indexSetRev = _length - 1 - indexSet; + if (indexSetRev >= SEGMENT.start && indexSetRev < SEGMENT.stop) bus->SetPixelColor(indexSet + skip, col); } } else { //live data, etc. if (reverseMode) i = _length - 1 - i; diff --git a/wled00/NpbWrapper.h b/wled00/NpbWrapper.h index 9f391556..54d21ac1 100644 --- a/wled00/NpbWrapper.h +++ b/wled00/NpbWrapper.h @@ -287,6 +287,15 @@ public: return 0; } + uint8_t* GetPixels(void) + { + switch (_type) { + case NeoPixelType_Grb: return _pGrb->Pixels(); break; + case NeoPixelType_Grbw: return _pGrbw->Pixels(); break; + } + return 0; + } + private: NeoPixelType _type; diff --git a/wled00/data/index.htm b/wled00/data/index.htm index 1cc88083..d9d1ccc9 100644 --- a/wled00/data/index.htm +++ b/wled00/data/index.htm @@ -1,662 +1,668 @@ - - - - - - WLED - + + + + + +WLED + @@ -666,143 +672,144 @@ input[type=number]::-webkit-outer-spin-button {
-
-
- - - - - -
-
-

Brightness

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

Brightness

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

White channel

-
- -
-
-
-
-
-
-
-
-
-

-
-
-
-
-
R
-
-
- - - -
-

Color palette

-
- - -
-
+
+
+
+

White channel

+
+ +
+
+
+
+
+
+
+
+
+

+
+
+
+
+
R
+
+
+ + + +
+

Color palette

+
+ + +
+
-
-

Effect speed

-
- -
- -
-
-
-

Effect intensity

-
- -
- -
-
-
-

Effect mode

-
- -
-
- Loading... -
-
-
- -
-
- Loading... -
-
- -
-
+
+

Effect speed

+
+ +
+ +
+
+
+

Effect intensity

+
+ +
+ +
+
+
+

Effect mode

+
+ +
+
+Loading... +
+
+
-
-

Load from slot

- - - -
- - - -
- - - -
- - - -
-
- Slot 16 can save all segments.

-
- First preset:
- Last preset:
- Time per preset: s
- Transition: s -
+
+
+Loading... +
+
+ +
+
+ +
+

Load from slot

+ + + +
+ + + +
+ + + +
+ + + +
+
+Slot 16 can save all segments.

+
+First preset:
+Last preset:
+Time per preset: s
+Transition: s +
- - - - + + + +
@@ -810,16 +817,16 @@ input[type=number]::-webkit-outer-spin-button {