From c43e31c500936bdb947d3791ee87f8d2168c7ebf Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 11 Jan 2022 22:34:45 +0800 Subject: [PATCH 1/2] fixing some bugs on oqc test. there's an issue with the modals that has to be fixed next... --- services/shellchat/Cargo.toml | 2 +- services/shellchat/src/cmds.rs | 50 ++++++++++++++++++++--------- services/shellchat/src/cmds/test.rs | 5 ++- services/shellchat/src/oqc_test.rs | 4 +-- 4 files changed, 41 insertions(+), 20 deletions(-) diff --git a/services/shellchat/Cargo.toml b/services/shellchat/Cargo.toml index 8928920d4..5c445e353 100644 --- a/services/shellchat/Cargo.toml +++ b/services/shellchat/Cargo.toml @@ -73,7 +73,7 @@ utralib = {path = "../../utralib"} debugprint = [] spinortest = [] # for spinor testing. contra-indicated with PDDB, as it steals memory from the PDDB. benchmarks = [] # adds the benchmark routines. Left off normally to free up code and memory space. -default = ["benchmarks"] # "debugprint" +default = [] # "debugprint" [target.'cfg(any(windows,unix))'.dependencies] debug-here = "*" diff --git a/services/shellchat/src/cmds.rs b/services/shellchat/src/cmds.rs index f368f978e..775d45607 100644 --- a/services/shellchat/src/cmds.rs +++ b/services/shellchat/src/cmds.rs @@ -84,7 +84,7 @@ mod echo; use echo::*; mod test; use test::*; mod sleep; use sleep::*; mod sensors; use sensors::*; -mod callback; use callback::*; +// mod callback; use callback::*; mod rtc_cmd; use rtc_cmd::*; mod vibe; use vibe::*; mod ssid; use ssid::*; @@ -92,10 +92,8 @@ mod ver; use ver::*; //mod audio; use audio::*; // this command is currently contra-indicated with PDDB, as the test audio currently overlaps the PDDB space. We'll fix this eventually, but for now, let's switch to PDDB mode. mod backlight; use backlight::*; mod accel; use accel::*; -mod sha; use sha::*; mod ecup; use ecup::*; mod trng_cmd; use trng_cmd::*; -mod engine; use engine::*; mod console; use console::*; //mod memtest; use memtest::*; mod keys; use keys::*; @@ -104,6 +102,14 @@ mod jtag_cmd; use jtag_cmd::*; mod net_cmd; use net_cmd::*; mod pddb_cmd; use pddb_cmd::*; +#[cfg(feature="benchmarks")] +mod engine; +#[cfg(feature="benchmarks")] +use engine::*; +#[cfg(feature="benchmarks")] +mod sha; +#[cfg(feature="benchmarks")] +use sha::*; #[cfg(feature="benchmarks")] mod aes_cmd; #[cfg(feature="benchmarks")] @@ -118,16 +124,13 @@ pub struct CmdEnv { test_cmd: Test, sleep_cmd: Sleep, sensors_cmd: Sensors, - callback_cmd: CallBack, + //callback_cmd: CallBack, rtc_cmd: RtcCmd, vibe_cmd: Vibe, ssid_cmd: Ssid, //audio_cmd: Audio, - sha_cmd: Sha, ecup_cmd: EcUpdate, - aes_cmd: Aes, trng_cmd: TrngCmd, - engine_cmd: Engine, //memtest_cmd: Memtest, keys_cmd: Keys, jtag_cmd: JtagCmd, @@ -135,6 +138,12 @@ pub struct CmdEnv { pddb_cmd: PddbCmd, wlan_cmd: Wlan, + #[cfg(feature="benchmarks")] + sha_cmd: Sha, + #[cfg(feature="benchmarks")] + aes_cmd: Aes, + #[cfg(feature="benchmarks")] + engine_cmd: Engine, //fcc_cmd: Fcc, } impl CmdEnv { @@ -152,10 +161,13 @@ impl CmdEnv { xns: xous_names::XousNames::new().unwrap(), }; //let fcc = Fcc::new(&mut common); + #[cfg(feature="benchmarks")] let sha = Sha::new(&xns, &mut common); + #[cfg(feature="benchmarks")] let aes = Aes::new(&xns, &mut common); - let ecup = EcUpdate::new(&mut common); + #[cfg(feature="benchmarks")] let engine = Engine::new(&xns, &mut common); + let ecup = EcUpdate::new(&mut common); //let memtest = Memtest::new(&xns, &mut common); // print our version info @@ -175,16 +187,13 @@ impl CmdEnv { test_cmd: Test::new(&xns), sleep_cmd: Sleep::new(&xns), sensors_cmd: Sensors::new(), - callback_cmd: CallBack::new(), + //callback_cmd: CallBack::new(), rtc_cmd: RtcCmd::new(&xns), vibe_cmd: Vibe::new(), ssid_cmd: Ssid::new(), //audio_cmd: Audio::new(&xns), - sha_cmd: sha, ecup_cmd: ecup, - aes_cmd: aes, trng_cmd: TrngCmd::new(), - engine_cmd: engine, //memtest_cmd: memtest, keys_cmd: Keys::new(&xns), jtag_cmd: JtagCmd::new(&xns), @@ -192,6 +201,12 @@ impl CmdEnv { pddb_cmd: PddbCmd::new(&xns), wlan_cmd: Wlan::new(), + #[cfg(feature="benchmarks")] + sha_cmd: sha, + #[cfg(feature="benchmarks")] + aes_cmd: aes, + #[cfg(feature="benchmarks")] + engine_cmd: engine, //fcc_cmd: fcc, } } @@ -210,7 +225,7 @@ impl CmdEnv { &mut self.test_cmd, &mut self.sleep_cmd, &mut self.sensors_cmd, - &mut self.callback_cmd, + //&mut self.callback_cmd, &mut self.rtc_cmd, &mut self.vibe_cmd, &mut self.ssid_cmd, @@ -218,11 +233,8 @@ impl CmdEnv { //&mut self.audio_cmd, &mut backlight_cmd, &mut accel_cmd, - &mut self.sha_cmd, &mut self.ecup_cmd, - &mut self.aes_cmd, &mut self.trng_cmd, - &mut self.engine_cmd, &mut console_cmd, // &mut self.memtest_cmd, &mut self.keys_cmd, @@ -231,6 +243,12 @@ impl CmdEnv { &mut self.net_cmd, &mut self.pddb_cmd, + #[cfg(feature="benchmarks")] + &mut self.sha_cmd, + #[cfg(feature="benchmarks")] + &mut self.aes_cmd, + #[cfg(feature="benchmarks")] + &mut self.engine_cmd, //&mut self.fcc_cmd, ]; diff --git a/services/shellchat/src/cmds/test.rs b/services/shellchat/src/cmds/test.rs index 558860a1e..98b9cee1a 100644 --- a/services/shellchat/src/cmds/test.rs +++ b/services/shellchat/src/cmds/test.rs @@ -35,6 +35,7 @@ pub struct Test { start_elapsed: Option, end_elapsed: Option, oqc_cid: Option, + kbd: Option, oqc_start: u64, #[cfg(any(target_os = "none", target_os = "xous"))] jtag: jtag::Jtag, @@ -70,6 +71,7 @@ impl Test { start_elapsed: None, end_elapsed: None, oqc_cid: None, + kbd: Some(keyboard::Keyboard::new(&xns).unwrap()), // allocate and save for use in the oqc_tester, so that the xous_names table is fully allocated oqc_start: 0, #[cfg(any(target_os = "none", target_os = "xous"))] jtag: jtag::Jtag::new(&xns).unwrap(), @@ -411,11 +413,12 @@ impl<'a> ShellCmdApi<'a> for Test { oc } else { let oqc_cid = Arc::new(AtomicU32::new(0)); + let kbd = self.kbd.take().expect("someone took the keyboard server before we could use it!"); // start the OQC thread let _ = std::thread::spawn({ let oqc_cid = oqc_cid.clone(); move || { - crate::oqc_test::oqc_test(oqc_cid); + crate::oqc_test::oqc_test(oqc_cid, kbd); } }); // wait until the OQC thread has connected itself diff --git a/services/shellchat/src/oqc_test.rs b/services/shellchat/src/oqc_test.rs index 283651347..c4eaca746 100644 --- a/services/shellchat/src/oqc_test.rs +++ b/services/shellchat/src/oqc_test.rs @@ -19,7 +19,7 @@ pub(crate) enum OqcOp { } static SERVER_STARTED: AtomicBool = AtomicBool::new(false); -pub(crate) fn oqc_test(oqc_cid: Arc) { +pub(crate) fn oqc_test(oqc_cid: Arc, kbd: keyboard::Keyboard) { // only start the server once! if SERVER_STARTED.load(Ordering::SeqCst) { return @@ -31,7 +31,7 @@ pub(crate) fn oqc_test(oqc_cid: Arc) { let oqc_sid = xns.register_name(SERVER_NAME_OQC, None).expect("can't register server"); let ticktimer = ticktimer_server::Ticktimer::new().unwrap(); - let kbd = keyboard::Keyboard::new(&xns).unwrap(); + //let kbd = keyboard::Keyboard::new(&xns).unwrap(); kbd.register_raw_listener( SERVER_NAME_OQC, OqcOp::KeyCode.to_usize().unwrap() From a8d7c7e9e268875a0fef2abf53ee70f83f1c846f Mon Sep 17 00:00:00 2001 From: bunnie Date: Wed, 12 Jan 2022 02:01:33 +0800 Subject: [PATCH 2/2] cleann up the oqc test --- Cargo.lock | 1 + services/gam/src/tokens.rs | 3 +- services/modals/src/api.rs | 18 ++++- services/modals/src/lib.rs | 34 ++++++++++ services/modals/src/main.rs | 105 +++++++++++++++++++++++++++-- services/shellchat/Cargo.toml | 1 + services/shellchat/src/oqc_test.rs | 39 ++--------- 7 files changed, 162 insertions(+), 39 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 086d038b5..b53a9f55a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1978,6 +1978,7 @@ dependencies = [ "llio", "log", "log-server", + "modals", "net", "num-derive", "num-traits", diff --git a/services/gam/src/tokens.rs b/services/gam/src/tokens.rs index ac0c91748..371959ff4 100644 --- a/services/gam/src/tokens.rs +++ b/services/gam/src/tokens.rs @@ -12,7 +12,7 @@ use xous_ipc::String; */ // if you add more UxContexts, and you want them authorized by the GAM, add their names here. -const TOKEN_SLOTS: usize = 9; +const TOKEN_SLOTS: usize = 8; const EXPECTED_BOOT_CONTEXTS: [&'static str; TOKEN_SLOTS] = [ "shellchat", "main menu", @@ -20,7 +20,6 @@ const EXPECTED_BOOT_CONTEXTS: [&'static str; TOKEN_SLOTS] = [ "emoji menu", "rootkeys modal", "rootkeys menu", - "test modal", "pddb modal", "shared modal", ]; diff --git a/services/modals/src/api.rs b/services/modals/src/api.rs index ae0dc0f61..15395cb6c 100644 --- a/services/modals/src/api.rs +++ b/services/modals/src/api.rs @@ -51,6 +51,16 @@ pub struct ManagedProgress { pub current_work: u32, } +/// This isn't a terribly useful notification -- it's basically read-only, no interactivity, +/// but you can animate the text. Mainly used for testing routines. Might be modifiable +/// into something more useful with a bit of thought, but for now, MVP. +#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Copy, Clone)] +pub struct DynamicNotification { + pub token: [u32; 4], + pub title: Option>, + pub text: Option>, +} + #[derive(num_derive::FromPrimitive, num_derive::ToPrimitive, Debug)] pub(crate) enum Opcode { // these are blocking calls @@ -62,10 +72,12 @@ pub(crate) enum Opcode { PromptWithTextResponse, /// simple notification Notification, + /// dynamic notification - a simple non-interactive notification that allows its text to be dynamically updated + DynamicNotification, // these are non-blocking calls /// add an item to the radio box or check box. Note that all added items - /// are cleared after the relevant "action" call happens (PrmoptWith[Fixed,Multi]Response) + /// are cleared after the relevant "action" call happens (PromptWith[Fixed,Multi]Response) AddModalItem, /// raise a progress bar StartProgress, @@ -73,6 +85,10 @@ pub(crate) enum Opcode { UpdateProgress, /// lower a progress bar StopProgress, + /// update a dynamic notification's text + UpdateDynamicNotification, + /// close dynamic notification + CloseDynamicNotification, GetMutex, diff --git a/services/modals/src/lib.rs b/services/modals/src/lib.rs index c8abba3c7..d2ddb8dfc 100644 --- a/services/modals/src/lib.rs +++ b/services/modals/src/lib.rs @@ -177,6 +177,40 @@ impl Modals { Ok(ret) } + pub fn dynamic_notification(&self, title: Option<&str>, text: Option<&str>) -> Result<(), xous::Error> { + self.lock(); + let spec = DynamicNotification { + token: self.token, + title: if let Some(t) = title {Some(xous_ipc::String::from_str(t))} else {None}, + text: if let Some(t) = text {Some(xous_ipc::String::from_str(t))} else {None}, + }; + let buf = Buffer::into_buf(spec).or(Err(xous::Error::InternalError))?; + buf.lend(self.conn, Opcode::DynamicNotification.to_u32().unwrap()).or(Err(xous::Error::InternalError))?; + Ok(()) + } + pub fn dynamic_notification_update(&self, title: Option<&str>, text: Option<&str>) -> Result<(), xous::Error> { + let spec = DynamicNotification { + token: self.token, + title: if let Some(t) = title {Some(xous_ipc::String::from_str(t))} else {None}, + text: if let Some(t) = text {Some(xous_ipc::String::from_str(t))} else {None}, + }; + let buf = Buffer::into_buf(spec).or(Err(xous::Error::InternalError))?; + buf.lend(self.conn, Opcode::UpdateDynamicNotification.to_u32().unwrap()).or(Err(xous::Error::InternalError))?; + Ok(()) + } + pub fn dynamic_notification_close(&self) -> Result<(), xous::Error> { + self.lock(); + send_message(self.conn, + Message::new_scalar(Opcode::CloseDynamicNotification.to_usize().unwrap(), + self.token[0] as usize, + self.token[1] as usize, + self.token[2] as usize, + self.token[3] as usize, + ) + ).expect("couldn't stop progress"); + Ok(()) + } + /// busy-wait until we have acquired a mutex on the Modals server fn lock(&self) { while !self.try_get_mutex() { diff --git a/services/modals/src/main.rs b/services/modals/src/main.rs index 320cbb749..2d103f593 100644 --- a/services/modals/src/main.rs +++ b/services/modals/src/main.rs @@ -30,6 +30,7 @@ enum RendererState { ResponseText(TextEntryPayload), ResponseRadio(ItemName), ResponseCheckBox(CheckBoxPayload), + RunDynamicNotification(DynamicNotification), } #[derive(num_derive::FromPrimitive, num_derive::ToPrimitive, Debug)] @@ -45,10 +46,14 @@ pub(crate) enum RendererOp { AddModalItem, + UpdateDynamicNotification, + CloseDynamicNotification, + ModalRedraw, ModalKeypress, ModalDrop, Quit, + Gutter, } #[xous::xous_main] @@ -85,6 +90,11 @@ fn xmain() -> ! { renderer_cid, RendererOp::NotificationReturn.to_u32().unwrap() ); + let mut gutter = gam::modal::Notification::new( + renderer_cid, + RendererOp::Gutter.to_u32().unwrap() + ); + gutter.set_manual_dismiss(false); let mut progress_action = Slider::new(renderer_cid, RendererOp::NotificationReturn.to_u32().unwrap(), 0, 100, 1, Some("%"), 0, true, true ); @@ -111,18 +121,18 @@ fn xmain() -> ! { log::debug!("renderer message: {:?}", msg); match FromPrimitive::from_usize(msg.body.id()) { Some(RendererOp::InitiateOp) => { - log::info!("InitiateOp called"); + log::debug!("InitiateOp called"); let mutex_op = op.lock().unwrap(); match *mutex_op { RendererState::RunText(config) => { - log::info!("initiating text entry modal"); + log::debug!("initiating text entry modal"); renderer_modal.modify( Some(ActionType::TextEntry(text_action)), Some(config.prompt.as_str().unwrap()), false, None, true, None ); renderer_modal.activate(); - log::info!("should be active!"); + log::debug!("should be active!"); }, RendererState::RunNotification(config) => { renderer_modal.modify( @@ -137,7 +147,7 @@ fn xmain() -> ! { end_work = config.end_work; last_percentage = compute_checked_percentage( config.current_work, start_work, end_work); - log::info!("init percentage: {}, current: {}, start: {}, end: {}", last_percentage, config.current_work, start_work, end_work); + log::debug!("init percentage: {}, current: {}, start: {}, end: {}", last_percentage, config.current_work, start_work, end_work); progress_action.set_state(last_percentage); renderer_modal.modify( @@ -179,6 +189,23 @@ fn xmain() -> ! { ); renderer_modal.activate(); }, + RendererState::RunDynamicNotification(config) => { + let mut top_text = String::new(); + if let Some(title) = config.title { + top_text.push_str(title.as_str().unwrap()); + } + let mut bot_text = String::new(); + if let Some(text) = config.text { + bot_text.push_str(text.as_str().unwrap()); + } + renderer_modal.modify( + Some(ActionType::Notification(gutter)), + Some(&top_text), config.title.is_none(), + Some(&bot_text), config.text.is_none(), + None + ); + renderer_modal.activate(); + }, RendererState::None => { log::error!("Operation initiated with no argument specified. Ignoring request."); continue; @@ -209,6 +236,35 @@ fn xmain() -> ! { Some(RendererOp::FinishProgress) => { renderer_modal.gam.relinquish_focus().unwrap(); }, + Some(RendererOp::UpdateDynamicNotification) => { + let mutex_op = op.lock().unwrap(); + match *mutex_op { + RendererState::RunDynamicNotification(config) => { + let mut top_text = String::new(); + if let Some(title) = config.title { + top_text.push_str(title.as_str().unwrap()); + } + let mut bot_text = String::new(); + if let Some(text) = config.text { + bot_text.push_str(text.as_str().unwrap()); + } + renderer_modal.modify( + None, + Some(&top_text), config.title.is_none(), + Some(&bot_text), config.text.is_none(), + None + ); + renderer_modal.redraw(); + } + _ => { + log::error!("UX return opcode does not match our current operation in flight. This is a serious internal error."); + panic!("UX return opcode does not match our current operation in flight. This is a serious internal error."); + } + } + }, + Some(RendererOp::CloseDynamicNotification) => { + renderer_modal.gam.relinquish_focus().unwrap(); + }, Some(RendererOp::TextEntryReturn) => { let mut mutex_op = op.lock().unwrap(); match *mutex_op { @@ -258,6 +314,9 @@ fn xmain() -> ! { } } }, + Some(RendererOp::Gutter) => { + log::info!("gutter op, doing nothing"); + }, Some(RendererOp::AddModalItem) => { let buffer = unsafe { Buffer::from_memory_message(msg.body.memory_message().unwrap()) }; let item = buffer.to_original::().unwrap(); @@ -499,6 +558,44 @@ fn xmain() -> ! { let fwd_buf = Buffer::into_buf(manageditem.item).unwrap(); fwd_buf.lend(renderer_cid, RendererOp::AddModalItem.to_u32().unwrap()).expect("couldn't add item"); } + Some(Opcode::DynamicNotification) => { + let buffer = unsafe { Buffer::from_memory_message(msg.body.memory_message().unwrap()) }; + let spec = buffer.to_original::().unwrap(); + if spec.token != token_lock.unwrap_or(default_nonce) { + log::warn!("Attempt to access modals without a mutex lock. Ignoring."); + continue; + } + *op.lock().unwrap() = RendererState::RunDynamicNotification(spec); + send_message( + renderer_cid, + Message::new_scalar(RendererOp::InitiateOp.to_usize().unwrap(), 0, 0, 0, 0) + ).expect("couldn't initiate UX op"); + }, + Some(Opcode::UpdateDynamicNotification) => { + let buffer = unsafe { Buffer::from_memory_message(msg.body.memory_message().unwrap()) }; + let spec = buffer.to_original::().unwrap(); + if spec.token != token_lock.unwrap_or(default_nonce) { + log::warn!("Attempt to access modals without a mutex lock. Ignoring."); + continue; + } + *op.lock().unwrap() = RendererState::RunDynamicNotification(spec); + send_message( + renderer_cid, + Message::new_scalar(RendererOp::UpdateDynamicNotification.to_usize().unwrap(), 0, 0, 0, 0) + ).expect("couldn't initiate UX op"); + }, + Some(Opcode::CloseDynamicNotification) => msg_scalar_unpack!(msg, t0, t1, t2, t3, { + let token = [t0 as u32, t1 as u32, t2 as u32, t3 as u32]; + if token != token_lock.unwrap_or(default_nonce) { + log::warn!("Attempt to access modals without a mutex lock. Ignoring."); + continue; + } + send_message( + renderer_cid, + Message::new_scalar(RendererOp::CloseDynamicNotification.to_usize().unwrap(), 0, 0, 0, 0) + ).expect("couldn't close dynamic notification"); + token_lock = None; + }), Some(Opcode::Quit) => { log::warn!("Shared modal UX handler exiting."); break diff --git a/services/shellchat/Cargo.toml b/services/shellchat/Cargo.toml index 5c445e353..0b2a58a0c 100644 --- a/services/shellchat/Cargo.toml +++ b/services/shellchat/Cargo.toml @@ -35,6 +35,7 @@ jtag = {path="../jtag"} net = {path="../net"} dns = {path="../dns"} pddb = {path="../pddb"} +modals = {path="../modals"} trng = {path = "../trng"} diff --git a/services/shellchat/src/oqc_test.rs b/services/shellchat/src/oqc_test.rs index c4eaca746..a65c03a24 100644 --- a/services/shellchat/src/oqc_test.rs +++ b/services/shellchat/src/oqc_test.rs @@ -1,5 +1,4 @@ use num_traits::*; -use gam::modal::*; use keyboard::{RowCol, KeyRawStates}; use core::sync::atomic::{AtomicU32, Ordering, AtomicBool}; use std::sync::Arc; @@ -38,21 +37,9 @@ pub(crate) fn oqc_test(oqc_cid: Arc, kbd: keyboard::Keyboard) { ); let com = com::Com::new(&xns).unwrap(); let llio = llio::Llio::new(&xns); + let gam = gam::Gam::new(&xns).unwrap(); - let test_cid = xous::connect(oqc_sid).unwrap(); - let mut test_action = Notification::new( - test_cid, - OqcOp::UxGutter.to_u32().unwrap() - ); - test_action.manual_dismiss = false; - let mut test_modal = Modal::new( - "test modal", - ActionType::Notification(test_action), - None, - Some("Initializing..."), - GlyphStyle::Small, - 8 - ); + let modal = modals::Modals::new(&xns).unwrap(); let mut test_run = false; let mut remaining = populate_vectors(); let mut bot_str = String::new(); @@ -69,15 +56,9 @@ pub(crate) fn oqc_test(oqc_cid: Arc, kbd: keyboard::Keyboard) { match FromPrimitive::from_usize(msg.body.id()) { Some(OqcOp::Trigger) => xous::msg_blocking_scalar_unpack!(msg, timeout_set, _, _, _, { if !test_run { - test_modal.spawn_helper(oqc_sid, test_modal.sid, - OqcOp::ModalRedraw.to_u32().unwrap(), - OqcOp::ModalKeys.to_u32().unwrap(), - OqcOp::ModalDrop.to_u32().unwrap(), - ); - // test the screen com.set_backlight(255, 255).unwrap(); - test_modal.gam.selftest(8_000); // 12_000 by default + gam.selftest(8_000); // 12_000 by default // now start the keyboard test timeout = if timeout_set > 120_000 { @@ -89,11 +70,7 @@ pub(crate) fn oqc_test(oqc_cid: Arc, kbd: keyboard::Keyboard) { last_redraw_time = start_time; log::info!("raising modal"); render_string(&mut bot_str, &remaining, timeout - (ticktimer.elapsed_ms() - start_time)); - test_modal.modify(None, None, false, - Some(bot_str.as_str()), false, None); - test_modal.activate(); - test_modal.redraw(); - test_modal.gam.set_vibe(true).unwrap(); + modal.dynamic_notification(None, Some(bot_str.as_str())).expect("couldn't raise test modal"); // start a thread that advances the timer when not hitting keys xous::create_thread_2(ping_thread, xous::connect(oqc_sid).unwrap() as usize, timeout as usize).unwrap(); @@ -137,9 +114,7 @@ pub(crate) fn oqc_test(oqc_cid: Arc, kbd: keyboard::Keyboard) { } if elapsed - last_redraw_time > 100 { // rate limit redraws to 10Hz render_string(&mut bot_str, &remaining, timeout - (elapsed - start_time)); - test_modal.modify(None, None, false, - Some(bot_str.as_str()), false, None); - test_modal.redraw(); + modal.dynamic_notification_update(None, Some(bot_str.as_str())).expect("couldn't update test modal"); last_redraw_time = elapsed; llio.vibe(llio::VibePattern::Short).unwrap(); } @@ -156,7 +131,7 @@ pub(crate) fn oqc_test(oqc_cid: Arc, kbd: keyboard::Keyboard) { if finished { passing = Some(true); com.set_backlight(0, 0).unwrap(); - test_modal.gam.relinquish_focus().unwrap(); + modal.dynamic_notification_close().unwrap(); log::info!("all keys hit, exiting"); test_finished = true; } @@ -164,7 +139,7 @@ pub(crate) fn oqc_test(oqc_cid: Arc, kbd: keyboard::Keyboard) { // timeout passing = Some(false); com.set_backlight(0, 0).unwrap(); - test_modal.gam.relinquish_focus().unwrap(); + modal.dynamic_notification_close().unwrap(); log::info!("test done, relinquishing focus"); test_finished = true; }