@@ -2,17 +2,15 @@ boolean MSGEQ7read() {
2
2
return fft_available;
3
3
}
4
4
5
-
6
5
#define MSGEQ7_OUT_MAX 255
7
6
8
7
int MSGEQ7get (int band, int channel) {
9
- int value = map ((fftData[band] * 100 ), 0 , 100 , 0 , MSGEQ7_OUT_MAX);
8
+ int value = map ((fftData[band] * 1000 ), 0 , 100 , 0 , MSGEQ7_OUT_MAX); // TODO: should be 100, but testing at home
10
9
// Serial.printf("Band: %u = %u\n", band, value);
11
10
return value;
12
11
}
13
12
14
- int barWidth = (kMatrixWidth / 8 ) / 2 ;
15
- int blockWidth = barWidth * 8 ;
13
+ int barWidth = (kMatrixHeight / 8 );
16
14
17
15
void drawPixel (int x, int y, CRGB color) {
18
16
leds[XY (x, y)] = color;
@@ -34,41 +32,26 @@ void FunkyPlank() {
34
32
int hue = MSGEQ7get (band, 0 );
35
33
int v = map (MSGEQ7get (band, 0 ), 0 , MSGEQ7_OUT_MAX, 10 , 255 );
36
34
for (int b = 0 ; b < barWidth; b++) {
37
- int xpos = blockWidth - (barWidth * band) - b;
38
- drawPixel (xpos, 0 , CHSV (hue, 255 , v));
39
- // Serial.printf("band: %u, hue: %u v: %u\n", band, hue, v);
35
+ int pos = (barWidth * band) + b;
36
+ drawPixel (0 , pos , CHSV (hue, 255 , v));
37
+ Serial.printf (" pos: %u band: %u hue: %u v: %u\n " , pos , band, hue, v);
40
38
// drawPixel((offset + band + 1), 0, CHSV(hue, 255, 255));
41
39
}
42
40
}
43
41
44
- // display values of left channel on DMD
45
- for (int band = 0 ; band < 8 ; band++ )
46
- {
47
- int hue = MSGEQ7get (band, 1 );
48
- int v = map (MSGEQ7get (band, 1 ), 0 , MSGEQ7_OUT_MAX, 10 , 255 );
49
- for (int b = 0 ; b < barWidth; b++) {
50
- int xpos = blockWidth + 1 + (barWidth * band) + b;
51
- drawPixel (xpos, 0 , CHSV (hue, 255 , v));
42
+ // Update the display:
43
+ for (int i = (kMatrixHeight - 1 ); i >= 0 ; i--) {
44
+ for (int j = (kMatrixWidth - 1 ); j >= 0 ; j--) {
45
+ int src = XY ((j - 1 ), i);
46
+ int dst = XY (j, i);
47
+ leds[dst] = leds[src];
52
48
}
53
49
}
54
-
55
- FastLED.show ();
56
- moveUp ();
50
+ FastLED.show (); // TODO: needs non-blocking delay
57
51
58
52
}
59
53
}
60
54
61
- void moveUp () {
62
- // Update the display:
63
- for (int i = (kMatrixHeight - 1 ); i >= 0 ; i--) {
64
- for (int j = (kMatrixWidth - 1 ); j >= 0 ; j--) {
65
- int src = XY (j, (i - 1 ));
66
- int dst = XY (j, i);
67
- leds[dst] = leds[src];
68
- }
69
- }
70
- }
71
-
72
55
73
56
// DJ Light -----------------------------------------------------------------------------------
74
57
@@ -85,20 +68,19 @@ void DJLight() {
85
68
if (newReading) {
86
69
87
70
int bands[8 ];
88
- for (int band = 0 ; band < 8 ; band++ )
89
- {
90
- bands[band] = MSGEQ7get (band, 1 );
71
+ for (int band = 0 ; band < 8 ; band++ ) {
72
+ bands[band] = MSGEQ7get (band, 1 ) / 2 ;
91
73
}
92
74
93
75
94
76
// leds[mid] = CRGB(bands[6], bands[5] / 8, bands[1] / 2);
95
77
// leds[mid].fadeToBlackBy(bands[3] / 12);
96
78
97
79
98
- ledsAudio[mid] = CRGB (bands[5 ]/ 2 , bands[2 ]/ 2 , bands[0 ]/ 2 );
80
+ ledsAudio[mid] = CRGB (bands[5 ], bands[2 ], bands[0 ]);
99
81
ledsAudio[mid].fadeToBlackBy ((map (bands[1 ], 0 , MSGEQ7_OUT_MAX, 255 , 10 )));
100
82
101
- Serial.printf (" RGB: %u %u %u\n " , bands[5 ]/ 2 , bands[2 ]/ 2 , bands[0 ]/ 2 );
83
+ Serial.printf (" RGB: %u %u %u\n " , bands[5 ], bands[2 ], bands[0 ]);
102
84
103
85
104
86
// move to the left
0 commit comments