Beat 1 (every 4th) = full white 50ms snap, others = barely visible 6,6,6 — sharp contrast for phase detection

This commit is contained in:
ash
2026-07-03 07:43:26 +00:00
parent eb5d66d29b
commit acd3cc51fe
+13 -3
View File
@@ -37,17 +37,27 @@ void midi_task(void* parameter) {
uint32_t tick = midi_tick_count;
uint32_t now = millis();
// Calculate beat using MIDI tick count (24 ticks per beat/PPQN)
uint32_t current_beat = tick / 24;
// Check if we've crossed a beat boundary.
if (current_beat != last_beat) {
last_beat = current_beat;
flash_start = now;
mux.set_led_color(6, 255, 255, 255);
// Beat 1 every 4th beat = full white, others near-invisible
if (current_beat % 4 == 0) {
mux.set_led_color(6, 255, 255, 255);
} else {
mux.set_led_color(6, 6, 6, 6);
}
mux.show();
}
// After 50ms, snap to dim regardless of beat type
if (flash_start > 0 && now - flash_start >= 50) {
mux.set_led_color(6, 20, 20, 20);
mux.show();
flash_start = 0;
}
// Handle flash animation
if (flash_start > 0) {
uint32_t elapsed = now - flash_start;