From ae7ee770ee685677965ef4e38863559d8728a1c4 Mon Sep 17 00:00:00 2001 From: bunnie Date: Sun, 29 Oct 2023 23:02:44 +0800 Subject: [PATCH] expose the GAM minimum redraw period this could be useful for functions that have to rapidly toggle events on the screen and want to make sure that the last event actually is rendered. --- services/gam/src/lib.rs | 1 + services/gam/src/main.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/services/gam/src/lib.rs b/services/gam/src/lib.rs index 550f68e8f..a3cfd42f8 100644 --- a/services/gam/src/lib.rs +++ b/services/gam/src/lib.rs @@ -31,6 +31,7 @@ use ime_plugin_api::{ImefCallback, ApiToken}; #[doc = include_str!("../README.md")] +pub const RATE_LIMIT_MS: usize = 33; pub const SYSTEM_STYLE: GlyphStyle = GlyphStyle::Tall; // Add names here and insert them into the EXPECTED_BOOT_CONTEXTS structure below. diff --git a/services/gam/src/main.rs b/services/gam/src/main.rs index 3e3d26fba..9ced5ddb8 100644 --- a/services/gam/src/main.rs +++ b/services/gam/src/main.rs @@ -175,7 +175,7 @@ fn wrapped_main() -> ! { continue; // don't allow any redraws if a powerdown is requested } let elapsed_time = ticktimer.elapsed_ms(); - if elapsed_time - last_time > 33 { // rate limit updates, no point in going faster than the eye can see + if elapsed_time - last_time > gam::RATE_LIMIT_MS as u64 { // rate limit updates, no point in going faster than the eye can see last_time = elapsed_time; if deface(&gfx, &trng, &mut canvases) {