Debug: beat 1 (downbeat) full white, other beats dimmer (64) — visually identify phase
This commit is contained in:
+9
-2
@@ -29,6 +29,7 @@ void midi_task(void* parameter) {
|
||||
// Beat timing fixes for precise beat alignment - sync to real MIDI time, not hardcoded tempo
|
||||
uint32_t last_beat = UINT32_MAX;
|
||||
uint32_t flash_start = 0;
|
||||
uint8_t flash_peak = 255;
|
||||
|
||||
while (true) {
|
||||
midi_transport.update();
|
||||
@@ -45,7 +46,13 @@ void midi_task(void* parameter) {
|
||||
if (current_beat != last_beat) {
|
||||
last_beat = current_beat;
|
||||
flash_start = now;
|
||||
mux.set_led_color(6, 255, 255, 255);
|
||||
// Beat 1 of each bar (every 4th beat) = full white; others dimmer
|
||||
if (current_beat % 4 == 0) {
|
||||
flash_peak = 255;
|
||||
} else {
|
||||
flash_peak = 64;
|
||||
}
|
||||
mux.set_led_color(6, flash_peak, flash_peak, flash_peak);
|
||||
mux.show();
|
||||
}
|
||||
|
||||
@@ -58,7 +65,7 @@ void midi_task(void* parameter) {
|
||||
flash_start = 0;
|
||||
} else {
|
||||
float b = 1.0f - (float)elapsed / 80.0f;
|
||||
uint8_t v = (uint8_t)(255 * b * b);
|
||||
uint8_t v = (uint8_t)((float)flash_peak * b * b);
|
||||
mux.set_led_color(6, v, v, v);
|
||||
mux.show();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user