From 08b0940d732b94e6080e57d534d3d0de92dc5436 Mon Sep 17 00:00:00 2001 From: Me Here Date: Mon, 1 Jun 2026 07:54:23 -0500 Subject: [PATCH] pm-kit: redraw periodically (~7fps) so the metronome reliably appears Blank-screen fix attempt: the single boot-time draw (right after the init DISPON) was likely lost; the peripheral test worked because it redrew every frame. Redraw on change AND every ~140ms. (Audio timing checked between redraws; partial/playhead redraw is the next step to tighten it.) Co-Authored-By: Claude Opus 4.8 (1M context) --- rust/pm-kit/src/main.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rust/pm-kit/src/main.rs b/rust/pm-kit/src/main.rs index 0e0e95c..9091b73 100644 --- a/rust/pm-kit/src/main.rs +++ b/rust/pm-kit/src/main.rs @@ -184,6 +184,7 @@ fn main() -> ! { let (mut pa, mut pb) = (false, false); let mut joy_zone = 0i8; let mut full_redraw = true; + let mut last_draw_us = 0u64; let mut hb = false; let mut hb_us = 0u64; led.set_low().unwrap(); @@ -262,8 +263,9 @@ fn main() -> ! { let _ = spk.channel_b.set_duty_cycle(0); } - // ---- draw: full screen only on change; the bar-position strip every frame ---- - if full_redraw { + // ---- draw: on change, and periodically (so a draw lost right after init reappears, and + // the playhead advances). ~7 fps; partial/playhead-only redraw is the next optimization. ---- + if full_redraw || now.wrapping_sub(last_draw_us) > 140_000 { let lanes: Vec = track .lanes .iter() @@ -282,8 +284,8 @@ fn main() -> ! { pm_ui::draw_metronome(&mut display, &screen).ok(); } full_redraw = false; + last_draw_us = now; } - let _ = pm_ui::draw_progress(&mut display, phase, playing, 62); // heartbeat LED (~1 Hz) if now.wrapping_sub(hb_us) > 500_000 {