Beat 1 (every 4th) = full white 50ms snap, others = barely visible 6,6,6 — sharp contrast for phase detection
This commit is contained in:
+12
-2
@@ -37,17 +37,27 @@ void midi_task(void* parameter) {
|
|||||||
uint32_t tick = midi_tick_count;
|
uint32_t tick = midi_tick_count;
|
||||||
uint32_t now = millis();
|
uint32_t now = millis();
|
||||||
|
|
||||||
// Calculate beat using MIDI tick count (24 ticks per beat/PPQN)
|
|
||||||
uint32_t current_beat = tick / 24;
|
uint32_t current_beat = tick / 24;
|
||||||
|
|
||||||
// Check if we've crossed a beat boundary.
|
|
||||||
if (current_beat != last_beat) {
|
if (current_beat != last_beat) {
|
||||||
last_beat = current_beat;
|
last_beat = current_beat;
|
||||||
flash_start = now;
|
flash_start = now;
|
||||||
|
// Beat 1 every 4th beat = full white, others near-invisible
|
||||||
|
if (current_beat % 4 == 0) {
|
||||||
mux.set_led_color(6, 255, 255, 255);
|
mux.set_led_color(6, 255, 255, 255);
|
||||||
|
} else {
|
||||||
|
mux.set_led_color(6, 6, 6, 6);
|
||||||
|
}
|
||||||
mux.show();
|
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
|
// Handle flash animation
|
||||||
if (flash_start > 0) {
|
if (flash_start > 0) {
|
||||||
uint32_t elapsed = now - flash_start;
|
uint32_t elapsed = now - flash_start;
|
||||||
|
|||||||
Reference in New Issue
Block a user