@@ -7268,37 +7268,70 @@ uint16_t mode_single_eqbar(void) {
72687268 // Grab the intensity value for peak decay speed, bound it between 1 and 32, invert for ease of use.
72697269 peakDecay = map (255 - SEGMENT.intensity , 1 , 255 , 1 , 32 );
72707270 }
7271- int barHeight = map (fftResult[freqBin], 0 , 255 , 0 , SEGLEN); // Grab new bar height
7271+ int barHeight = 0 ;
7272+ if (strip.isMatrix || SEGMENT.is2D ()){
7273+ barHeight = map (fftResult[freqBin], 0 , 255 , 0 , SEG_H); // Grab new bar height
7274+ } else {
7275+ barHeight = map (fftResult[freqBin], 0 , 255 , 0 , SEGLEN); // Grab new bar height
7276+ }
72727277 if (barHeight > *prevBarHeight) *prevBarHeight = barHeight; // Update the previous bar height if the new height is greater
72737278
72747279 SEGMENT.fade_out (SEGMENT.speed ); // Always fade out existing bars according to speed slider.
72757280
72767281 // Draw the main bar (but not peak pixel)
72777282 for (int i = 0 ; i < barHeight; i++) {
7278- SEGMENT.setPixelColor (i, SEGMENT.color_from_palette (i, true , PALETTE_SOLID_WRAP, 0 ));
7283+ if (strip.isMatrix || SEGMENT.is2D ()){
7284+ // If we are in a matrix or 2D segment, draw the bar vertically
7285+ for (int j = 0 ; j < SEG_W; j++) {
7286+ SEGMENT.setPixelColorXY (j, i, SEGMENT.color_from_palette (i, true , PALETTE_SOLID_WRAP, 0 ));
7287+ }
7288+ } else {
7289+ // Otherwise draw the bar horizontally
7290+ SEGMENT.setPixelColor (i, SEGMENT.color_from_palette (i, true , PALETTE_SOLID_WRAP, 0 ));
7291+ }
72797292 }
72807293
72817294 if (peakDecay == 0 ){
72827295 // No peak pixel if decay is set to zero, just draw the peak pixel of the bar.
72837296 if (barHeight > 0 ) {
7284- SEGMENT.setPixelColor (barHeight, SEGMENT.color_from_palette (barHeight, true , PALETTE_SOLID_WRAP, 0 ));
7297+ if (strip.isMatrix || SEGMENT.is2D ()) {
7298+ for (int j = 0 ; j < SEG_W; j++) {
7299+ SEGMENT.setPixelColorXY (j, barHeight, SEGMENT.color_from_palette (barHeight, true , PALETTE_SOLID_WRAP, 0 ));
7300+ }
7301+ } else {
7302+ SEGMENT.setPixelColor (barHeight, SEGMENT.color_from_palette (barHeight, true , PALETTE_SOLID_WRAP, 0 ));
7303+ }
72857304 }
72867305 } else {
72877306 // Decrement prevBarHeight according to peakDecay
72887307 if (*prevBarHeight > 0 && (SEGENV.call % (peakDecay > 1 ? peakDecay : 1 )) == 0 ) (*prevBarHeight)--;
72897308
72907309 // Set peak pixel and clear pixels over peak (otherwise they would fadewith value from speed slider)
72917310 if (*prevBarHeight > 0 ) {
7292- SEGMENT.setPixelColor (*prevBarHeight, SEGCOLOR (2 ));
7311+
7312+ if (strip.isMatrix || SEGMENT.is2D ()) {
7313+ for (int j = 0 ; j < SEG_W; j++) {
7314+ SEGMENT.setPixelColorXY (j, *prevBarHeight, SEGCOLOR (2 ));
7315+ }
7316+ } else {
7317+ SEGMENT.setPixelColor (*prevBarHeight, SEGCOLOR (2 ));
7318+ }
72937319 }
72947320 if (*prevBarHeight < SEGLEN) {
7295- SEGMENT.setPixelColor (*prevBarHeight + 1 , BLACK); // clear next pixel immediately.
7321+
7322+ if (strip.isMatrix || SEGMENT.is2D ()) {
7323+ for (int j = 0 ; j < SEG_W; j++) {
7324+ SEGMENT.setPixelColorXY (j, *prevBarHeight + 1 , BLACK); // clear next pixel immediately.
7325+ }
7326+ } else {
7327+ SEGMENT.setPixelColor (*prevBarHeight + 1 , BLACK); // clear next pixel immediately.
7328+ }
72967329 }
72977330 }
72987331
72997332 return FRAMETIME;
73007333}
7301- static const char _data_FX_MODE_SINGLE_EQBAR[] PROGMEM = " Single EQ Bar@Fade speed,Peak decay,Frequency bin;!,,Peaks;!;!;1vf ;sx=128,ix=170,c1=128,si=0" ;
7334+ static const char _data_FX_MODE_SINGLE_EQBAR[] PROGMEM = " Single EQ Bar@Fade speed,Peak decay,Frequency bin;!,,Peaks;!;!;12vf ;sx=128,ix=170,c1=128,si=0" ;
73027335
73037336// ///////////////////////
73047337// ** 2D Funky plank //
0 commit comments