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:
parent
95b960e071
commit
08b0940d73
1 changed files with 5 additions and 3 deletions
|
|
@ -184,6 +184,7 @@ fn main() -> ! {
|
||||||
let (mut pa, mut pb) = (false, false);
|
let (mut pa, mut pb) = (false, false);
|
||||||
let mut joy_zone = 0i8;
|
let mut joy_zone = 0i8;
|
||||||
let mut full_redraw = true;
|
let mut full_redraw = true;
|
||||||
|
let mut last_draw_us = 0u64;
|
||||||
let mut hb = false;
|
let mut hb = false;
|
||||||
let mut hb_us = 0u64;
|
let mut hb_us = 0u64;
|
||||||
led.set_low().unwrap();
|
led.set_low().unwrap();
|
||||||
|
|
@ -262,8 +263,9 @@ fn main() -> ! {
|
||||||
let _ = spk.channel_b.set_duty_cycle(0);
|
let _ = spk.channel_b.set_duty_cycle(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- draw: full screen only on change; the bar-position strip every frame ----
|
// ---- draw: on change, and periodically (so a draw lost right after init reappears, and
|
||||||
if full_redraw {
|
// 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
|
let lanes: Vec<pm_ui::LaneView> = track
|
||||||
.lanes
|
.lanes
|
||||||
.iter()
|
.iter()
|
||||||
|
|
@ -282,8 +284,8 @@ fn main() -> ! {
|
||||||
pm_ui::draw_metronome(&mut display, &screen).ok();
|
pm_ui::draw_metronome(&mut display, &screen).ok();
|
||||||
}
|
}
|
||||||
full_redraw = false;
|
full_redraw = false;
|
||||||
|
last_draw_us = now;
|
||||||
}
|
}
|
||||||
let _ = pm_ui::draw_progress(&mut display, phase, playing, 62);
|
|
||||||
|
|
||||||
// heartbeat LED (~1 Hz)
|
// heartbeat LED (~1 Hz)
|
||||||
if now.wrapping_sub(hb_us) > 500_000 {
|
if now.wrapping_sub(hb_us) > 500_000 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue