Beat 1 = RED (100ms), other beats = WHITE (50ms)

This commit is contained in:
ash
2026-07-03 07:50:16 +00:00
parent ad977d3b09
commit b859527169
+5 -17
View File
@@ -42,34 +42,22 @@ void midi_task(void* parameter) {
if (current_beat != last_beat) {
last_beat = current_beat;
flash_start = now;
// Beat 1 (every 4th) = yellow, others = white
// Beat 1 (every 4th) = RED, others = WHITE
if (current_beat % 4 == 0) {
mux.set_led_color(6, 255, 255, 0);
mux.set_led_color(6, 255, 0, 0);
} else {
mux.set_led_color(6, 255, 255, 255);
}
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
// Beat 1 holds red for 100ms, others snap to dim after 50ms
if (flash_start > 0) {
uint32_t elapsed = now - flash_start;
if (elapsed >= 80) {
uint32_t hold = (last_beat % 4 == 0) ? 100 : 50;
if (now - flash_start >= hold) {
mux.set_led_color(6, 20, 20, 20);
mux.show();
flash_start = 0;
} else {
float b = 1.0f - (float)elapsed / 80.0f;
uint8_t v = (uint8_t)(255 * b * b);
mux.set_led_color(6, v, v, v);
mux.show();
}
}