From 0bd83999d5be630083c8ec505480915473c77a41 Mon Sep 17 00:00:00 2001 From: Damian Schneider Date: Thu, 10 Jul 2025 09:09:55 +0200 Subject: [PATCH 1/3] adding center bin selection to 2D GEQ setting custom3 to 0 gives the "old" behaviour, this is the default. existing presets will have the custom3 slider at the center, changing presets that do not use the full width. --- wled00/FX.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 8bc6d8a1be..035e3d4092 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -7235,6 +7235,7 @@ uint16_t mode_2DGEQ(void) { // By Will Tatam. Code reduction by Ewoud Wijma. if (!strip.isMatrix || !SEGMENT.is2D()) return mode_static(); // not a 2D set-up const int NUM_BANDS = map(SEGMENT.custom1, 0, 255, 1, 16); + const int CENTER_BIN = map(SEGMENT.custom3, 0, 31, 0, 15); const int cols = SEG_W; const int rows = SEG_H; @@ -7256,13 +7257,19 @@ uint16_t mode_2DGEQ(void) { // By Will Tatam. Code reduction by Ewoud Wijma. if ((fadeoutDelay <= 1 ) || ((SEGENV.call % fadeoutDelay) == 0)) SEGMENT.fadeToBlackBy(SEGMENT.speed); for (int x=0; x < cols; x++) { - uint8_t band = map(x, 0, cols, 0, NUM_BANDS); - if (NUM_BANDS < 16) band = map(band, 0, NUM_BANDS - 1, 0, 15); // always use full range. comment out this line to get the previous behaviour. + int band = map(x, 0, cols, 0, NUM_BANDS); + //if (NUM_BANDS < 16) band = map(band, 0, NUM_BANDS - 1, 0, 15); // always use full range. comment out this line to get the previous behaviour. + if (NUM_BANDS < 16) { + int startBin = constrain(CENTER_BIN - NUM_BANDS/2, 0, 15 - NUM_BANDS + 1); + if(NUM_BANDS <= 1) + band = CENTER_BIN; // mapping does not work for 1 band + else + band = map(band, 0, NUM_BANDS - 1, startBin, startBin + NUM_BANDS - 1); + } band = constrain(band, 0, 15); unsigned colorIndex = band * 17; int barHeight = map(fftResult[band], 0, 255, 0, rows); // do not subtract -1 from rows here if (barHeight > previousBarHeight[x]) previousBarHeight[x] = barHeight; //drive the peak up - uint32_t ledColor = BLACK; for (int y=0; y < barHeight; y++) { if (SEGMENT.check1) //color_vertical / color bars toggle @@ -7279,7 +7286,7 @@ uint16_t mode_2DGEQ(void) { // By Will Tatam. Code reduction by Ewoud Wijma. return FRAMETIME; } // mode_2DGEQ() -static const char _data_FX_MODE_2DGEQ[] PROGMEM = "GEQ@Fade speed,Ripple decay,# of bands,,,Color 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,,Bin,Color bars;!,,Peaks;!;2f;c1=255,c2=64,pal=11,si=0,c3=0"; ///////////////////////// From 832bae3fa9c61402160cb4f248ed7051f417af83 Mon Sep 17 00:00:00 2001 From: Damian Schneider Date: Thu, 10 Jul 2025 09:11:51 +0200 Subject: [PATCH 2/3] revert blank removal --- wled00/FX.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 035e3d4092..359ba2e515 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -7270,6 +7270,7 @@ uint16_t mode_2DGEQ(void) { // By Will Tatam. Code reduction by Ewoud Wijma. unsigned colorIndex = band * 17; int barHeight = map(fftResult[band], 0, 255, 0, rows); // do not subtract -1 from rows here if (barHeight > previousBarHeight[x]) previousBarHeight[x] = barHeight; //drive the peak up + uint32_t ledColor = BLACK; for (int y=0; y < barHeight; y++) { if (SEGMENT.check1) //color_vertical / color bars toggle From d25fc2ed04175bb0ed186fbe08162f6c5715e337 Mon Sep 17 00:00:00 2001 From: Damian Schneider Date: Thu, 10 Jul 2025 09:13:55 +0200 Subject: [PATCH 3/3] change comment, remove old code --- wled00/FX.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 359ba2e515..41e5bb387d 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -7258,11 +7258,10 @@ uint16_t mode_2DGEQ(void) { // By Will Tatam. Code reduction by Ewoud Wijma. for (int x=0; x < cols; x++) { int band = map(x, 0, cols, 0, NUM_BANDS); - //if (NUM_BANDS < 16) band = map(band, 0, NUM_BANDS - 1, 0, 15); // always use full range. comment out this line to get the previous behaviour. if (NUM_BANDS < 16) { int startBin = constrain(CENTER_BIN - NUM_BANDS/2, 0, 15 - NUM_BANDS + 1); if(NUM_BANDS <= 1) - band = CENTER_BIN; // mapping does not work for 1 band + band = CENTER_BIN; // map() does not work for single band else band = map(band, 0, NUM_BANDS - 1, startBin, startBin + NUM_BANDS - 1); }