From 27e5f0b72f57cb98af49cbdca30834950e752fef Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 25 Nov 2025 19:07:06 +0800 Subject: [PATCH] fix flashing bar artifact in vault UI --- apps-baosec/vault2/src/main.rs | 2 +- apps-baosec/vault2/src/totp.rs | 2 +- apps-baosec/vault2/src/ux.rs | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/apps-baosec/vault2/src/main.rs b/apps-baosec/vault2/src/main.rs index 198ca6faa..f1a0c614c 100644 --- a/apps-baosec/vault2/src/main.rs +++ b/apps-baosec/vault2/src/main.rs @@ -486,7 +486,7 @@ fn main() -> ! { vault_ui.redraw(); } _ => { - log::info!("unhandled key {}", k); + log::debug!("unhandled key {}", k); } } } diff --git a/apps-baosec/vault2/src/totp.rs b/apps-baosec/vault2/src/totp.rs index 448196040..67f682b26 100644 --- a/apps-baosec/vault2/src/totp.rs +++ b/apps-baosec/vault2/src/totp.rs @@ -179,7 +179,7 @@ pub(crate) fn pumper( { // we really want mode.lock() to be in a different scope so... if mode_cache == VaultMode::Totp { - tt.sleep_ms(50).unwrap(); + tt.sleep_ms(250).unwrap(); send_message( self_conn, Message::new_scalar(PumpOp::Pump.to_usize().unwrap(), 0, 0, 0, 0), diff --git a/apps-baosec/vault2/src/ux.rs b/apps-baosec/vault2/src/ux.rs index 9c226a873..053e2b6ba 100644 --- a/apps-baosec/vault2/src/ux.rs +++ b/apps-baosec/vault2/src/ux.rs @@ -100,6 +100,7 @@ impl VaultUi { .set_margin(TotpLayout::totp_margin()) .pane_size(TotpLayout::list_box()) .style(TotpLayout::list_font()); + totp_list.set_autoflush(false); let gfx = Gfx::new(&xns).unwrap(); let style = DEFAULT_FONT; @@ -258,9 +259,10 @@ impl VaultUi { self.totp_list.draw(TotpLayout::timer_box().br().y); // draw the timer element + let mut object_list = ObjectList::new(); let mut timer_box = TotpLayout::timer_box(); timer_box.style = DrawStyle::new(PixelColor::Dark, PixelColor::Light, 1); - self.gfx.draw_rectangle(timer_box).ok(); + object_list.push(ClipObjectType::Rect(timer_box)).unwrap(); // draw the duration bar let current_time = std::time::SystemTime::now() @@ -281,7 +283,8 @@ impl VaultUi { let delta_width = (delta * width * 128) / (30 * 128 * 1000); timer_remaining.br = Point::new(width - delta_width, timer_remaining.br().y); timer_remaining.style = DrawStyle::new(PixelColor::Light, PixelColor::Light, 1); - self.gfx.draw_rectangle(timer_remaining).ok(); + object_list.push(ClipObjectType::Rect(timer_remaining)).unwrap(); + self.gfx.draw_object_list(object_list).unwrap(); } VaultMode::Password => { /*