@@ -41,7 +41,7 @@ void EQ() {
4141 // display values of left channel on DMD
4242 for ( band = 0 ; band < 7 ; band++ )
4343 {
44- int count = map (mapNoise (MSGEQ7get (band)), 0 , 255 , 0 , HEIGHT);
44+ int count = map (mapNoise (MSGEQ7get (band)), 0 , MSGEQ7_OUT_MAX , 0 , HEIGHT);
4545 // int count = map(band, 0, 6, 1, HEIGHT);
4646 for (int b = 0 ; b < barWidth; b++) {
4747 xpos = blockWidth - (barWidth * band) - b;
@@ -67,7 +67,7 @@ void EQ() {
6767 // display values of left channel on DMD
6868 for ( band = 0 ; band < 7 ; band++ )
6969 {
70- int count = map (mapNoise (MSGEQ7get (band)), 0 , 255 , 0 , HEIGHT);
70+ int count = map (mapNoise (MSGEQ7get (band)), 0 , MSGEQ7_OUT_MAX , 0 , HEIGHT);
7171 // int count = map(band, 0, 6, 1, HEIGHT);
7272
7373 for (int b = 0 ; b < barWidth; b++) {
@@ -116,19 +116,19 @@ void VU() {
116116
117117 // Led strip output
118118 if (newReading) {
119- // fill_solid(leds, kMatrixWidth, CRGB::Black);
120-
121- int displayPeakL = map (MSGEQ7get (MSGEQ7_LOW, 0 ), 0 , 255 , 0 , round (HEIGHT / 2 ));
122- int displayPeakR = map (MSGEQ7get (MSGEQ7_LOW, 1 ), 0 , 255 , 0 , round (HEIGHT / 2 ));
119+ Serial.printf (" max = %u, value=%u\n " , MSGEQ7_OUT_MAX, MSGEQ7get (MSGEQ7_MID, 0 ));
120+ int displayPeakL = map (MSGEQ7get (MSGEQ7_MID, 0 ), 0 , MSGEQ7_OUT_MAX, 0 , round (HEIGHT / 2 ));
121+ int displayPeakR = map (MSGEQ7get (MSGEQ7_LOW, 1 ), 0 , MSGEQ7_OUT_MAX, 0 , round (HEIGHT / 2 ));
123122 Serial.print (" Display peak: " );
124123 Serial.println (displayPeakL);
125124
126125 moveUp ();
127126 int offset = round (HEIGHT / 2 );
128127
129- for (int i = 1 ; i <= HEIGHT; i++){
130- drawPixel (0 , i, CRGB::Black);
131- }
128+ // reset first row to black
129+ for (int i = 0 ; i <= WIDTH; i++) {
130+ drawPixel (i, 0 , CRGB::Black);
131+ }
132132
133133 for (int i = 0 ; i < HEIGHT; i++) {
134134 drawPixel (offset, i, CRGB::Blue);
@@ -211,7 +211,7 @@ void FunkyPlank() {
211211 for ( band = 0 ; band < 7 ; band++ )
212212 {
213213 int hue = MSGEQ7get (band, 0 );
214- int v = map (MSGEQ7get (band, 0 ), 0 , 255 , 10 , 255 );
214+ int v = map (MSGEQ7get (band, 0 ), 0 , MSGEQ7_OUT_MAX , 10 , 255 );
215215 for (int b = 0 ; b < barWidth; b++) {
216216 int xpos = blockWidth - (barWidth * band) - b;
217217 drawPixel (xpos, 0 , CHSV (hue, 255 , v));
@@ -223,7 +223,7 @@ void FunkyPlank() {
223223 for ( band = 0 ; band < 7 ; band++ )
224224 {
225225 int hue = MSGEQ7get (band, 1 );
226- int v = map (MSGEQ7get (band, 1 ), 0 , 255 , 10 , 255 );
226+ int v = map (MSGEQ7get (band, 1 ), 0 , MSGEQ7_OUT_MAX , 10 , 255 );
227227 for (int b = 0 ; b < barWidth; b++) {
228228 int xpos = blockWidth + 1 + (barWidth * band) + b;
229229 drawPixel (xpos, 0 , CHSV (hue, 255 , v));
@@ -262,7 +262,7 @@ void DJLight() {
262262// leds[mid].fadeToBlackBy(bands[3] / 12);
263263
264264 leds[mid] = CRGB (bands[5 ]/2 , bands[2 ]/2 , bands[0 ]/2 );
265- leds[mid].fadeToBlackBy ((map (bands[1 ], 0 , 255 , 255 , 10 )));
265+ leds[mid].fadeToBlackBy ((map (bands[1 ], 0 , MSGEQ7_OUT_MAX , 255 , 10 )));
266266
267267 // move to the left
268268 for (int i = NUM_LEDS - 1 ; i > mid; i--) {
0 commit comments