diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 46502614..b16b50ce 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -7141,23 +7141,24 @@ uint16_t mode_2DGEQ(void) { // By Will Tatam. Code reduction by Ewoud Wijma. //WLEDMM if not enough remaining if (remaining < 1) {band++; remaining+= bandwidth;} //increase remaining but keep the current remaining remaining--; //consume remaining - + // Serial.printf("x %d b %d n %d w %f %f\n", x, band, NUM_BANDS, bandwidth, remaining); - 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. + uint8_t frBand = (NUM_BANDS < 16)?map(band, 0, NUM_BANDS - 1, 0, 15):band; // always use full range. comment out this line to get the previous behaviour. // band = constrain(band, 0, 15); //WLEDMM can never be out of bounds (I think...) - uint16_t colorIndex = band * 17; - uint16_t barHeight = map(fftResult[band], 0, 255, 0, rows); // do not subtract -1 from rows here + uint16_t colorIndex = frBand * 17; //WLEDMM 0.255 + uint16_t barHeight = map(fftResult[frBand], 0, 255, 0, rows); // do not subtract -1 from rows here // WLEDMM begin - smooth out bars if ((x > 0) && (x < (cols-1)) && (SEGMENT.check2)) { // get height of next (right side) bar - uint8_t nextband = map(x+1, 0, cols-1, 0, NUM_BANDS - 1); - if(cols > 24) nextband = map(x+2, 0, cols-1, 0, NUM_BANDS - 1); - if (NUM_BANDS < 16) nextband = map(nextband, 0, NUM_BANDS - 1, 0, 15); // always use full range. comment out this line to get the previous behaviour. - nextband = constrain(nextband, 0, 15); - uint16_t nextbarHeight = map(fftResult[nextband], 0, 255, 0, rows); // do not subtract -1 from rows here + uint8_t nextband = (remaining < 1)? band +1: band; + + frBand = (NUM_BANDS < 16)?map(nextband, 0, NUM_BANDS - 1, 0, 15):nextband; // always use full range. comment out this line to get the previous behaviour. + // nextband = constrain(nextband, 0, 15); + uint16_t nextbarHeight = map(fftResult[frBand], 0, 255, 0, rows); // do not subtract -1 from rows here // smooth height barHeight = (7*barHeight + 3*lastBarHeight + 3*nextbarHeight) / 12; // yeees, its 12 not 13 (10% amplification) + colorIndex = map(x, 0, cols-1, 0, 255); //WLEDMM } lastBarHeight = barHeight; // remember barheight (left side) for next iteration // WLEDMM end diff --git a/wled00/wled.h b/wled00/wled.h index e64f3833..e0a8aa9a 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2303110 +#define VERSION 2303111 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG