From 354f18efe7e704ce96dff8cd31ca529920cdbf58 Mon Sep 17 00:00:00 2001 From: Ashley Strahle Date: Fri, 3 Jul 2026 07:27:06 +0000 Subject: [PATCH] =?UTF-8?q?Beat=200=20(first=20beat=20after=20START)=20ful?= =?UTF-8?q?l=20white,=20subsequent=20beats=20dimmer=20=E2=80=94=20marks=20?= =?UTF-8?q?bar=20downbeat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 262177d..22a0b26 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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,14 @@ 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); + // First beat after each START is beat 1 (downbeat) — full white + // Loopy Pro sends START at bar boundaries so this is always beat 1 + if (current_beat == 0) { + flash_peak = 255; + } else { + flash_peak = 64; + } + mux.set_led_color(6, flash_peak, flash_peak, flash_peak); mux.show(); } @@ -58,7 +66,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(); }