diff --git a/services/status/src/main.rs b/services/status/src/main.rs index accde03c1..86fd87089 100644 --- a/services/status/src/main.rs +++ b/services/status/src/main.rs @@ -12,6 +12,7 @@ mod app_autogen; mod time; mod ecup; mod wifi; +mod preferences; use com::api::*; use root_keys::api::{BackupOp, BackupKeyboardLayout}; @@ -92,6 +93,9 @@ pub(crate) enum StatusOpcode { /// Raise the wifi menu WifiMenu, + + /// Raise the preferences menu + Preferences, Quit, } @@ -365,6 +369,7 @@ fn wrapped_main() -> ! { let thread_conn = xous::connect(status_sid).unwrap(); wifi::start_background_thread(); + preferences::start_background_thread(); // load system preferences let prefs = Arc::new(Mutex::new(userprefs::Manager::new())); @@ -401,14 +406,14 @@ fn wrapped_main() -> ! { }.unwrap_or_else(|error| { log::error!("cannot set radio status: {:?}", error) }); - + match all_prefs.connect_known_networks_on_boot { true => netmgr.connection_manager_run(), false => netmgr.connection_manager_stop(), }.unwrap_or_else(|error| { log::error!("cannot start connection manager: {:?}", error) }); - + match all_prefs.autobacklight_on_boot { true => send_message(status_cid, Message::new_scalar( StatusOpcode::EnableAutomaticBacklight.to_usize().unwrap(), 0,0,0,0)), @@ -862,6 +867,10 @@ fn wrapped_main() -> ! { ticktimer.sleep_ms(100).ok(); // yield for a moment to allow the previous menu to close gam.raise_menu(gam::WIFI_MENU_NAME).unwrap(); }, + Some(StatusOpcode::Preferences) => { + ticktimer.sleep_ms(100).ok(); // yield for a moment to allow the previous menu to close + gam.raise_menu(gam::PREFERENCES_MENU_NAME).unwrap(); + }, Some(StatusOpcode::Pump) => { let elapsed_time = ticktimer.elapsed_ms(); { // update the CPU load bar diff --git a/services/status/src/mainmenu.rs b/services/status/src/mainmenu.rs index d18353f02..fac5744f6 100644 --- a/services/status/src/mainmenu.rs +++ b/services/status/src/mainmenu.rs @@ -141,6 +141,14 @@ pub fn create_main_menu(keys: Arc>, menu_management_sid: xous::S close_on_select: true, }); + menuitems.push(MenuItem { + name: String::from_str(t!("mainmenu.preferences", xous::LANG)), + action_conn: Some(status_conn), + action_opcode: StatusOpcode::Preferences.to_u32().unwrap(), + action_payload: MenuPayload::Scalar([0, 0, 0, 0]), + close_on_select: true, + }); + menuitems.push(MenuItem { name: String::from_str(t!("mainmenu.lockdevice", xous::LANG)), action_conn: Some(status_conn),