mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
feat: wire up Preferences menu in status
This commit is contained in:
parent
a3a94ad50a
commit
17b7ba2ad0
2 changed files with 19 additions and 2 deletions
|
|
@ -12,6 +12,7 @@ mod app_autogen;
|
||||||
mod time;
|
mod time;
|
||||||
mod ecup;
|
mod ecup;
|
||||||
mod wifi;
|
mod wifi;
|
||||||
|
mod preferences;
|
||||||
|
|
||||||
use com::api::*;
|
use com::api::*;
|
||||||
use root_keys::api::{BackupOp, BackupKeyboardLayout};
|
use root_keys::api::{BackupOp, BackupKeyboardLayout};
|
||||||
|
|
@ -92,6 +93,9 @@ pub(crate) enum StatusOpcode {
|
||||||
|
|
||||||
/// Raise the wifi menu
|
/// Raise the wifi menu
|
||||||
WifiMenu,
|
WifiMenu,
|
||||||
|
|
||||||
|
/// Raise the preferences menu
|
||||||
|
Preferences,
|
||||||
Quit,
|
Quit,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -365,6 +369,7 @@ fn wrapped_main() -> ! {
|
||||||
let thread_conn = xous::connect(status_sid).unwrap();
|
let thread_conn = xous::connect(status_sid).unwrap();
|
||||||
|
|
||||||
wifi::start_background_thread();
|
wifi::start_background_thread();
|
||||||
|
preferences::start_background_thread();
|
||||||
|
|
||||||
// load system preferences
|
// load system preferences
|
||||||
let prefs = Arc::new(Mutex::new(userprefs::Manager::new()));
|
let prefs = Arc::new(Mutex::new(userprefs::Manager::new()));
|
||||||
|
|
@ -401,14 +406,14 @@ fn wrapped_main() -> ! {
|
||||||
}.unwrap_or_else(|error| {
|
}.unwrap_or_else(|error| {
|
||||||
log::error!("cannot set radio status: {:?}", error)
|
log::error!("cannot set radio status: {:?}", error)
|
||||||
});
|
});
|
||||||
|
|
||||||
match all_prefs.connect_known_networks_on_boot {
|
match all_prefs.connect_known_networks_on_boot {
|
||||||
true => netmgr.connection_manager_run(),
|
true => netmgr.connection_manager_run(),
|
||||||
false => netmgr.connection_manager_stop(),
|
false => netmgr.connection_manager_stop(),
|
||||||
}.unwrap_or_else(|error| {
|
}.unwrap_or_else(|error| {
|
||||||
log::error!("cannot start connection manager: {:?}", error)
|
log::error!("cannot start connection manager: {:?}", error)
|
||||||
});
|
});
|
||||||
|
|
||||||
match all_prefs.autobacklight_on_boot {
|
match all_prefs.autobacklight_on_boot {
|
||||||
true => send_message(status_cid, Message::new_scalar(
|
true => send_message(status_cid, Message::new_scalar(
|
||||||
StatusOpcode::EnableAutomaticBacklight.to_usize().unwrap(), 0,0,0,0)),
|
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
|
ticktimer.sleep_ms(100).ok(); // yield for a moment to allow the previous menu to close
|
||||||
gam.raise_menu(gam::WIFI_MENU_NAME).unwrap();
|
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) => {
|
Some(StatusOpcode::Pump) => {
|
||||||
let elapsed_time = ticktimer.elapsed_ms();
|
let elapsed_time = ticktimer.elapsed_ms();
|
||||||
{ // update the CPU load bar
|
{ // update the CPU load bar
|
||||||
|
|
|
||||||
|
|
@ -141,6 +141,14 @@ pub fn create_main_menu(keys: Arc<Mutex<RootKeys>>, menu_management_sid: xous::S
|
||||||
close_on_select: true,
|
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 {
|
menuitems.push(MenuItem {
|
||||||
name: String::from_str(t!("mainmenu.lockdevice", xous::LANG)),
|
name: String::from_str(t!("mainmenu.lockdevice", xous::LANG)),
|
||||||
action_conn: Some(status_conn),
|
action_conn: Some(status_conn),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue