From 12ef7cb2855c6e2d955ff33fc860fd4948b0076d Mon Sep 17 00:00:00 2001 From: Will Miles Date: Wed, 23 Oct 2024 19:47:44 -0400 Subject: [PATCH 1/9] Enable NON32XFER_HANDLER on ESP8266 This is a platform feature that asks forgiveness for PROGMEM misuse: it adds a handler such that incorrectly used PROGMEM will work without crashing, just really, *really* inefficiently. Given that most of our real-world use cases for PROGMEM strings are relatively infrequent text calls, we can err on the side of developer convenience and address performance problems if and when they arise. --- platformio.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/platformio.ini b/platformio.ini index 13b45feb7c..e49c32dabd 100644 --- a/platformio.ini +++ b/platformio.ini @@ -291,6 +291,7 @@ build_flags = ; -D PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48 ;; in case of linker errors like "section `.text1' will not fit in region `iram1_0_seg'" ; -D PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48_SECHEAP_SHARED ;; (experimental) adds some extra heap, but may cause slowdown -D USERMOD_AUDIOREACTIVE + -D NON32XFER_HANDLER ;; ask forgiveness for PROGMEM misuse lib_deps = #https://github.com/lorol/LITTLEFS.git From 827cf8786045eb2853ff640efd9407925d8db683 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Sun, 13 Oct 2024 11:01:05 +0200 Subject: [PATCH 2/9] Merge pull request #4188 from LuisFadini/0_15_brt_timezone Added BRT timezone --- wled00/data/settings_time.htm | 1 + wled00/ntp.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/wled00/data/settings_time.htm b/wled00/data/settings_time.htm index 52f3385ea2..0c6e68a790 100644 --- a/wled00/data/settings_time.htm +++ b/wled00/data/settings_time.htm @@ -182,6 +182,7 @@

Time setup

+
UTC offset: seconds (max. 18 hours)
Current local time is unknown.
diff --git a/wled00/ntp.cpp b/wled00/ntp.cpp index fb5e85b3ae..ddebd9499a 100644 --- a/wled00/ntp.cpp +++ b/wled00/ntp.cpp @@ -48,6 +48,7 @@ Timezone* tz = nullptr; #define TZ_ANCHORAGE 20 #define TZ_MX_CENTRAL 21 #define TZ_PAKISTAN 22 +#define TZ_BRASILIA 23 #define TZ_INIT 255 byte tzCurrent = TZ_INIT; //uninitialized @@ -168,6 +169,11 @@ void updateTimezone() { tcrStandard = tcrDaylight; break; } + case TZ_BRASILIA : { + tcrDaylight = {Last, Sun, Mar, 1, -180}; //Brasília Standard Time = UTC - 3 hours + tcrStandard = tcrDaylight; + break; + } } tzCurrent = currentTimezone; From ae076727104040c5419b6b681f5f6d889643f46b Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Tue, 26 Nov 2024 14:20:07 +0100 Subject: [PATCH 3/9] swirl effect bugfix avoid drawing outside of visible area --- wled00/FX.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 26bb99e259..62edcfe7c1 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -6214,9 +6214,9 @@ uint16_t mode_2Dsquaredswirl(void) { // By: Mark Kriegsman. https://g uint16_t ms = strip.now; - SEGMENT.addPixelColorXY(i, m, ColorFromPalette(SEGPALETTE, ms/29, 255, LINEARBLEND)); - SEGMENT.addPixelColorXY(j, n, ColorFromPalette(SEGPALETTE, ms/41, 255, LINEARBLEND)); - SEGMENT.addPixelColorXY(k, p, ColorFromPalette(SEGPALETTE, ms/73, 255, LINEARBLEND)); + if (i Date: Tue, 26 Nov 2024 15:33:56 +0100 Subject: [PATCH 4/9] allow tri fade effect on 0D (single pixel) --- wled00/FX.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 62edcfe7c1..a985386252 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -1743,7 +1743,7 @@ uint16_t mode_tricolor_fade(void) { return FRAMETIME; } -static const char _data_FX_MODE_TRICOLOR_FADE[] PROGMEM = "Tri Fade@!;1,2,3;!"; +static const char _data_FX_MODE_TRICOLOR_FADE[] PROGMEM = "Tri Fade@!;1,2,3;!;01"; /* From c44784071ef79d8e431d84a7e876a64add930394 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Wed, 27 Nov 2024 11:07:56 +0100 Subject: [PATCH 5/9] small tails for rolling balls --- wled00/FX.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index a985386252..9612070ee3 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -3048,7 +3048,8 @@ static uint16_t rolling_balls(void) { float cfac = float(scale8(8, 255-SEGMENT.speed) +1)*20000.0f; // this uses the Aircoookie conversion factor for scaling time using speed slider bool hasCol2 = SEGCOLOR(2); - if (!SEGMENT.check2) SEGMENT.fill(hasCol2 ? BLACK : SEGCOLOR(1)); + //if (!SEGMENT.check2) SEGMENT.fill(hasCol2 ? BLACK : SEGCOLOR(1)); + if (!SEGMENT.check2) SEGMENT.fade_out(253); // WLEDMM adding a bit of trail for (int i = 0; i < numBalls; i++) { float timeSinceLastUpdate = float((strip.now - balls[i].lastBounceUpdate))/cfac; From 402786c14e15799b2d4910f8298c69ab5395cbd0 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Wed, 27 Nov 2024 11:11:07 +0100 Subject: [PATCH 6/9] GEQ FLat mode (1D) --- wled00/FX.cpp | 45 ++++++++++++++++++++++++++++++++++----------- wled00/wled.h | 2 +- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 9612070ee3..37c0b8e8be 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -8101,15 +8101,36 @@ static const char _data_FX_MODE_WATERFALL[] PROGMEM = "Waterfall@!,Adjust color, #ifndef WLED_DISABLE_2D ///////////////////////// -// ** 2D GEQ // +// 1D / 2D GEQ // ///////////////////////// -uint16_t mode_2DGEQ(void) { // By Will Tatam. Code reduction by Ewoud Wijma. - if (!strip.isMatrix) return mode_static(); // not a 2D set-up + +// GEQ helper: either draws 2D, or flattens pixels to 1D +static void setFlatPixelXY(bool flatMode, int x, int y, uint32_t color, unsigned cols, unsigned rows, unsigned offset) { + if ((unsigned(x) >= cols) || (unsigned(y) >= rows)) return; // skip invisible + + if (!flatMode) SEGMENT.setPixelColorXY(x, y, color); // normal 2D + else { + y = rows - y -1 ; // reverse y + if (y & 0x01) y = (rows + y) / 2; // center bars: odd pixels to the right + else y = (rows - 1 - y) / 2; // even pixels to the left + + int pix = x*rows + y + offset; // flatten -> transpose x y so that bars stay bars + if (unsigned(pix) >= SEGLEN) return; // skip invisible + SEGMENT.setPixelColor(pix, color); + } +} + +uint16_t mode_2DGEQ(void) { // By Will Tatam. Code reduction by Ewoud Wijma. Flat Mode added by softhack007 + //if (!strip.isMatrix) return mode_static(); // not a 2D set-up, not a problem + bool flatMode = !SEGMENT.is2D(); const int NUM_BANDS = map2(SEGMENT.custom1, 0, 255, 1, 16); - const uint16_t cols = SEGMENT.virtualWidth(); - const uint16_t rows = SEGMENT.virtualHeight(); - if ((cols <=1) || (rows <=1)) return mode_static(); // not really a 2D set-up + const int vLength = SEGLEN; // for flat mode + const uint16_t cols = flatMode ? min(max(2, NUM_BANDS), (vLength+1)/2) : SEGMENT.virtualWidth(); + const uint16_t rows = flatMode ? vLength / cols : SEGMENT.virtualHeight(); + const unsigned offset = flatMode ? max(0, (vLength - rows*cols +1) / 2) : 0; // flatmode: always center effect + + if ((cols <=1) || (rows <=1)) return mode_static(); // too small if (!SEGENV.allocateData(cols*sizeof(uint16_t))) return mode_static(); //allocation failed uint16_t *previousBarHeight = reinterpret_cast(SEGENV.data); //array of previous bar heights per frequency band @@ -8175,7 +8196,7 @@ uint16_t mode_2DGEQ(void) { // By Will Tatam. Code reduction by Ewoud Wijma. if (barHeight > previousBarHeight[x]) previousBarHeight[x] = barHeight; //drive the peak up uint32_t ledColor = BLACK; - if ((! SEGMENT.check1) && (barHeight > 0)) { // use faster drawLine when single-color bars are needed + if ((! SEGMENT.check1) && !flatMode && (barHeight > 0)) { // use faster drawLine when single-color bars are needed ledColor = SEGMENT.color_from_palette(colorIndex, false, PALETTE_SOLID_WRAP, 0); SEGMENT.drawLine(int(x), max(0,int(rows)-barHeight), int(x), int(rows-1), ledColor, false); // max(0, ...) to prevent negative Y } else { @@ -8184,23 +8205,25 @@ uint16_t mode_2DGEQ(void) { // By Will Tatam. Code reduction by Ewoud Wijma. colorIndex = map(y, 0, rows-1, 0, 255); ledColor = SEGMENT.color_from_palette(colorIndex, false, PALETTE_SOLID_WRAP, 0); - SEGMENT.setPixelColorXY(x, rows-1 - y, ledColor); + setFlatPixelXY(flatMode, x, rows-1 - y, ledColor, cols, rows, offset); } } - if ((SEGMENT.intensity < 255) && (previousBarHeight[x] > 0) && (previousBarHeight[x] < rows)) // WLEDMM avoid "overshooting" into other segments - SEGMENT.setPixelColorXY(x, rows - previousBarHeight[x], (SEGCOLOR(2) != BLACK) ? SEGCOLOR(2) : ledColor); + if (!flatMode && (SEGMENT.intensity < 255) && (previousBarHeight[x] > 0) && (previousBarHeight[x] < rows)) // WLEDMM avoid "overshooting" into other segments - disable ripple pixels in 1D mode + setFlatPixelXY(flatMode, x, rows - previousBarHeight[x], (SEGCOLOR(2) != BLACK) ? SEGCOLOR(2) : ledColor, cols, rows, offset); if (rippleTime && previousBarHeight[x]>0) previousBarHeight[x]--; //delay/ripple effect } #ifdef SR_DEBUG + if (!flatMode) { // WLEDMM: abuse top left/right pixels for peak detection debugging SEGMENT.setPixelColorXY(cols-1, 0, (samplePeak > 0) ? GREEN : BLACK); if (samplePeak > 0) SEGMENT.setPixelColorXY(0, 0, GREEN); // WLEDMM end + } #endif return FRAMETIME; } // mode_2DGEQ() -static const char _data_FX_MODE_2DGEQ[] PROGMEM = "GEQ ☾@Fade speed,Ripple decay,# of bands,,,Color bars,Smooth bars ☾;!,,Peaks;!;2f;c1=255,c2=64,pal=11,si=0"; // Beatsin +static const char _data_FX_MODE_2DGEQ[] PROGMEM = "GEQ ☾@Fade speed,Ripple decay,# of bands,,,Color bars,Smooth bars ☾;!,,Peaks;!;12f;c1=255,c2=64,pal=11,si=0"; // Beatsin ///////////////////////// diff --git a/wled00/wled.h b/wled00/wled.h index 85a9fe8444..f2c0ac6eac 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2411150 +#define VERSION 2411270 // WLEDMM - you can check for this define in usermods, to only enabled WLEDMM specific code in the "right" fork. Its not defined in AC WLED. #define _MoonModules_WLED_ From 8ff0223520edf4cc934a734ce7e9880b61c32fa2 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Wed, 27 Nov 2024 11:59:13 +0100 Subject: [PATCH 7/9] GEQ flat mode for 2D MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit you still have to use a trick -> the "expand 1D" drop-down is hidden once you select a 2D-capable effect * Create your segment with 2 colums or 2 rows (might also need "transpose" * Select a 1D effect like chunchun * set expand to "Pixels" or "Bar" * now select the GEQ effect --> Flat GEQ runs in the previously set expand mode. --- wled00/FX.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 37c0b8e8be..838f763c33 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -8122,7 +8122,7 @@ static void setFlatPixelXY(bool flatMode, int x, int y, uint32_t color, unsigned uint16_t mode_2DGEQ(void) { // By Will Tatam. Code reduction by Ewoud Wijma. Flat Mode added by softhack007 //if (!strip.isMatrix) return mode_static(); // not a 2D set-up, not a problem - bool flatMode = !SEGMENT.is2D(); + bool flatMode = !SEGMENT.is2D() || (SEGMENT.width() < 3) || (SEGMENT.height() < 3); // also use flat mode when less than 3 colums or rows const int NUM_BANDS = map2(SEGMENT.custom1, 0, 255, 1, 16); const int vLength = SEGLEN; // for flat mode From 59d5ff02c551d82abeccae6b61f68468ad10395a Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Wed, 27 Nov 2024 13:18:43 +0100 Subject: [PATCH 8/9] Flat GEQ improvement for shorter stips only center bars if we more than 4 pixels per bar. --- wled00/FX.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 838f763c33..694239d78e 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -8110,10 +8110,11 @@ static void setFlatPixelXY(bool flatMode, int x, int y, uint32_t color, unsigned if (!flatMode) SEGMENT.setPixelColorXY(x, y, color); // normal 2D else { - y = rows - y -1 ; // reverse y - if (y & 0x01) y = (rows + y) / 2; // center bars: odd pixels to the right - else y = (rows - 1 - y) / 2; // even pixels to the left - + y = rows - y - 1; // reverse y + if (rows > 4) { // center y if we have more than 4 pixels per bar + if (y & 0x01) y = (rows + y) / 2; // center bars: odd pixels to the right + else y = (rows - 1 - y) / 2; // even pixels to the left + } int pix = x*rows + y + offset; // flatten -> transpose x y so that bars stay bars if (unsigned(pix) >= SEGLEN) return; // skip invisible SEGMENT.setPixelColor(pix, color); From f21b2949f1c470459f9d67656f10b0979b6e0af1 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Wed, 27 Nov 2024 21:13:46 +0100 Subject: [PATCH 9/9] fix for effect double restart problem when cross-fade is enabled we only use palette and brightness transitions, so effect restart at the transition end is not required. --- wled00/FX_fcn.cpp | 6 +++--- wled00/wled.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index 1c5779464b..0f750b0f03 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -494,12 +494,12 @@ void Segment::setCurrentPalette() { } void Segment::handleTransition() { - if (!transitional) return; + if (!transitional || !_t) return; // Early exit if no transition active unsigned long maxWait = millis() + 20; if (mode == FX_MODE_STATIC && next_time > maxWait) next_time = maxWait; if (progress() == 0xFFFFU) { if (_t) { - if (_t->_modeP != mode) markForReset(); + //if (_t->_modeP != mode) markForReset(); // WLEDMM effect transition disabled as it does not work (flashes due to double effect restart) delete _t; _t = nullptr; } @@ -618,7 +618,7 @@ void Segment::setMode(uint8_t fx, bool loadDefaults, bool sliderDefaultsOnly) { sOpt = extractModeDefaults(fx, "pal"); if (sOpt >= 0) {if (oldPalette==-1) oldPalette = palette; setPalette(sOpt);} else {if (oldPalette!=-1) setPalette(oldPalette); oldPalette = -1;} } } - if (!fadeTransition) markForReset(); // WLEDMM quickfix for effect "double startup" bug. -> only works when "Crossfade" is disabled (led settings) + /*if (!fadeTransition)*/ markForReset(); // WLEDMM quickfix for effect "double startup" bug. stateChanged = true; // send UDP/WS broadcast } } diff --git a/wled00/wled.h b/wled00/wled.h index f2c0ac6eac..fe1761a2d2 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2411270 +#define VERSION 2411271 // WLEDMM - you can check for this define in usermods, to only enabled WLEDMM specific code in the "right" fork. Its not defined in AC WLED. #define _MoonModules_WLED_ @@ -393,7 +393,7 @@ WLED_GLOBAL byte briS _INIT(128); // default brightness WLED_GLOBAL byte nightlightTargetBri _INIT(0); // brightness after nightlight is over WLED_GLOBAL byte nightlightDelayMins _INIT(60); WLED_GLOBAL byte nightlightMode _INIT(NL_MODE_FADE); // See const.h for available modes. Was nightlightFade -WLED_GLOBAL bool fadeTransition _INIT(false); // enable crossfading color transition // WLEDMM disabled - has bugs that will be solved in upstream beta4 +WLED_GLOBAL bool fadeTransition _INIT(true); // enable crossfading color transition // WLEDMM only do color x-fade -- effect x-fade has bugs that will be solved in upstream beta4 WLED_GLOBAL uint16_t transitionDelay _INIT(750); // default crossfade duration in ms WLED_GLOBAL uint_fast16_t briMultiplier _INIT(100); // % of brightness to set (to limit power, if you set it to 50 and set bri to 255, actual brightness will be 127)