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) <noreply@anthropic.com>
This commit is contained in:
Me Here 2026-06-01 07:54:23 -05:00
parent 95b960e071
commit 08b0940d73

View file

@ -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<pm_ui::LaneView> = 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 {