integrate app name in sec notes patch, make app name update retriggered on change

This commit is contained in:
bunnie 2022-02-24 19:44:24 +08:00
parent b47c7b2793
commit a9a5e5c9a9
4 changed files with 32 additions and 2 deletions

15
Cargo.lock generated
View file

@ -821,6 +821,21 @@ dependencies = [
"termcolor",
]
[[package]]
name = "espeak"
version = "0.1.0"
dependencies = [
"codec",
"log",
"log-server",
"num-derive",
"num-traits",
"ticktimer-server",
"utralib",
"xous",
"xous-names",
]
[[package]]
name = "eyre"
version = "0.6.5"

View file

@ -37,6 +37,7 @@ default-members = [
"services/modals",
"apps/ball",
"apps/repl",
"services/espeak",
]
members = [
"xous-ipc",
@ -89,6 +90,7 @@ members = [
"apps/ball",
"apps/repl",
"kernel",
"services/espeak",
]
resolver = "2"

View file

@ -309,6 +309,7 @@ fn xmain() -> ! {
}
});
};
sec_notes.lock().unwrap().insert("current_app".to_string(), format!("Running: Shellchat").to_string()); // this is the default app on boot
let mut stats_phase: usize = 0;
@ -728,13 +729,25 @@ fn xmain() -> ! {
Some(StatusOpcode::SwitchToShellchat) => {
ticktimer.sleep_ms(100).ok();
sec_notes.lock().unwrap().remove(&"current_app".to_string());
sec_notes.lock().unwrap().insert("current_app".to_string(), format!("Running: Shellchat").to_string());
gam.switch_to_app(gam::APP_NAME_SHELLCHAT, security_tv.token.unwrap()).expect("couldn't raise shellchat");
secnotes_force_redraw = true;
send_message(
cb_cid,
Message::new_scalar(StatusOpcode::Pump.to_usize().unwrap(), 0, 0, 0, 0),
).expect("couldn't trigger status update");
},
Some(StatusOpcode::SwitchToApp) => msg_scalar_unpack!(msg, index, _, _, _, {
ticktimer.sleep_ms(100).ok();
let app_name = app_autogen::app_index_to_name(index).expect("app index not found");
app_autogen::app_dispatch(&gam, security_tv.token.unwrap(), index).expect("cannot switch to app");
sec_notes.lock().unwrap().insert("current_app".to_string(), format!("Current app: {}", app_name).to_string());
sec_notes.lock().unwrap().remove(&"current_app".to_string());
sec_notes.lock().unwrap().insert("current_app".to_string(), format!("Running: {}", app_name).to_string());
secnotes_force_redraw = true;
send_message(
cb_cid,
Message::new_scalar(StatusOpcode::Pump.to_usize().unwrap(), 0, 0, 0, 0),
).expect("couldn't trigger status update");
}),
Some(StatusOpcode::TrySuspend) => {
if ((llio.adc_vbus().unwrap() as f64) * 0.005033) > 1.5 {

View file

@ -1319,7 +1319,7 @@ pub(crate) fn app_index_to_name(index: usize) -> Result<&'static str, AppDispatc
index,
name,
).unwrap();
}
}
}
writeln!(menu, r####" _ => Err(AppDispatchError::IndexNotFound(index)),
}}