From 80a835ba83f1e6464e3d89987bace37b1a37de99 Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 10 Mar 2022 15:33:14 +0800 Subject: [PATCH] fix up warnings and latest cargo.toml --- Cargo.lock | 14 +++++--------- services/modals/Cargo.toml | 2 ++ services/modals/src/main.rs | 20 +++++++++++++++++++- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8327da6e4..195291fe0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -637,13 +637,13 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "3.1.0" -source = "git+https://github.com/betrusted-io/curve25519-dalek.git?branch=main#c0ee5bf18c606b51bbffb02fde5801ac129b4e7d" +version = "3.2.1" +source = "git+https://github.com/betrusted-io/curve25519-dalek.git?branch=main#ec0fe92578bba6dd47457a9bb8287deb48432ce1" dependencies = [ "byteorder", "digest", "engine-25519", - "engine25519-as 0.1.0 (git+https://github.com/betrusted-io/engine25519-as.git?rev=6681e73c1fdc4a460b5ef9f9c7c91aef546d00f3)", + "engine25519-as", "log", "rand_core 0.5.1", "subtle", @@ -764,7 +764,7 @@ dependencies = [ name = "engine-25519" version = "0.1.0" dependencies = [ - "engine25519-as 0.1.0 (git+https://github.com/betrusted-io/engine25519-as.git?rev=274b82899d28535ac6d4b7869e26eef2039578d5)", + "engine25519-as", "llio", "log", "log-server", @@ -784,11 +784,6 @@ name = "engine25519-as" version = "0.1.0" source = "git+https://github.com/betrusted-io/engine25519-as.git?rev=274b82899d28535ac6d4b7869e26eef2039578d5#274b82899d28535ac6d4b7869e26eef2039578d5" -[[package]] -name = "engine25519-as" -version = "0.1.0" -source = "git+https://github.com/betrusted-io/engine25519-as.git?rev=6681e73c1fdc4a460b5ef9f9c7c91aef546d00f3#6681e73c1fdc4a460b5ef9f9c7c91aef546d00f3" - [[package]] name = "enum_dispatch" version = "0.3.7" @@ -1423,6 +1418,7 @@ dependencies = [ "rkyv", "ticktimer-server", "trng", + "tts-frontend", "utralib", "xous", "xous-ipc 0.9.7", diff --git a/services/modals/Cargo.toml b/services/modals/Cargo.toml index e2722a8b9..dbf3f1bcd 100644 --- a/services/modals/Cargo.toml +++ b/services/modals/Cargo.toml @@ -18,10 +18,12 @@ xous-ipc = { path = "../../xous-ipc" } rkyv = {version = "0.4.3", features = ["const_generics"], default-features = false} gam = {path="../gam"} trng = {path="../trng"} +tts-frontend = {path="../tts"} [target.'cfg(not(any(windows,unix)))'.dependencies] utralib = { path = "../../utralib"} [features] ux_tests = [] +tts = [] default = [] diff --git a/services/modals/src/main.rs b/services/modals/src/main.rs index 829434d22..f0589bb75 100644 --- a/services/modals/src/main.rs +++ b/services/modals/src/main.rs @@ -14,6 +14,8 @@ use std::sync::{Arc, Mutex}; use std::thread; use gam::modal::*; +#[cfg(feature="tts")] +use tts_frontend::TtsFrontend; use num_traits::*; @@ -72,6 +74,9 @@ fn xmain() -> ! { let renderer_sid = xous::create_server().expect("couldn't create a server for the modal UX renderer"); let renderer_cid = xous::connect(renderer_sid).expect("couldn't connect to the modal UX renderer"); + #[cfg(feature="tts")] + let tts = TtsFrontend::new(&xns).unwrap(); + let op = Arc::new(Mutex::new(RendererState::None)); // create a thread that just handles the redrawing requests let _redraw_handle = thread::spawn({ @@ -127,6 +132,8 @@ fn xmain() -> ! { match *mutex_op { RendererState::RunText(config) => { log::debug!("initiating text entry modal"); + #[cfg(feature="tts")] + tts.tts_simple(config.prompt.as_str().unwrap()).unwrap(); renderer_modal.modify( Some(ActionType::TextEntry(text_action)), Some(config.prompt.as_str().unwrap()), false, @@ -136,6 +143,8 @@ fn xmain() -> ! { log::debug!("should be active!"); }, RendererState::RunNotification(config) => { + #[cfg(feature="tts")] + tts.tts_simple(config.message.as_str().unwrap()).unwrap(); renderer_modal.modify( Some(ActionType::Notification(notification)), Some(config.message.as_str().unwrap()), false, @@ -150,7 +159,8 @@ fn xmain() -> ! { 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); - + #[cfg(feature="tts")] + tts.tts_simple(config.title.as_str().unwrap()).unwrap(); renderer_modal.modify( Some(ActionType::Slider(progress_action)), Some(config.title.as_str().unwrap()), false, @@ -167,6 +177,8 @@ fn xmain() -> ! { radiobuttons.add_item(*item); } fixed_items.clear(); + #[cfg(feature="tts")] + tts.tts_simple(config.prompt.as_str().unwrap()).unwrap(); renderer_modal.modify( Some(ActionType::RadioButtons(radiobuttons)), Some(config.prompt.as_str().unwrap()), false, @@ -183,6 +195,8 @@ fn xmain() -> ! { checkbox.add_item(*item); } fixed_items.clear(); + #[cfg(feature="tts")] + tts.tts_simple(config.prompt.as_str().unwrap()).unwrap(); renderer_modal.modify( Some(ActionType::CheckBoxes(checkbox)), Some(config.prompt.as_str().unwrap()), false, @@ -193,10 +207,14 @@ fn xmain() -> ! { RendererState::RunDynamicNotification(config) => { let mut top_text = String::new(); if let Some(title) = config.title { + #[cfg(feature="tts")] + tts.tts_simple(title.as_str().unwrap()).unwrap(); top_text.push_str(title.as_str().unwrap()); } let mut bot_text = String::new(); if let Some(text) = config.text { + #[cfg(feature="tts")] + tts.tts_simple(text.as_str().unwrap()).unwrap(); bot_text.push_str(text.as_str().unwrap()); } renderer_modal.modify(