diff --git a/services/status/src/main.rs b/services/status/src/main.rs index 536b26b5e..faf264b6d 100644 --- a/services/status/src/main.rs +++ b/services/status/src/main.rs @@ -345,7 +345,7 @@ fn wrapped_main() -> ! { StatusOpcode::Keypress.to_u32().unwrap() as usize, ); - let autobacklight_enabled = Arc::new(Mutex::new(false)); + let autobacklight_enabled = Arc::new(Mutex::new(true)); let (tx, rx): (Sender, Receiver) = unbounded(); let rx = Box::new(rx); @@ -404,7 +404,8 @@ fn wrapped_main() -> ! { match prefs.autobacklight_on_boot_or_value(true).unwrap() { true => send_message(status_cid, Message::new_scalar( StatusOpcode::EnableAutomaticBacklight.to_usize().unwrap(), 0,0,0,0)), - false => Ok(xous::Result::Ok), + false => send_message(status_cid, Message::new_scalar( + StatusOpcode::DisableAutomaticBacklight.to_usize().unwrap(), 0,0,0,0)), }.unwrap_or_else(|error| { log::error!("cannot set autobacklight status: {:?}", error); xous::Result::Ok diff --git a/services/status/src/mainmenu.rs b/services/status/src/mainmenu.rs index 78c4eeae3..23726e93b 100644 --- a/services/status/src/mainmenu.rs +++ b/services/status/src/mainmenu.rs @@ -14,6 +14,7 @@ pub fn create_main_menu(keys: Arc>, menu_management_sid: xous::S let mut menuitems = Vec::::new(); // no backlight on versions with no display + /* #[cfg(not(feature="tts"))] menuitems.push(MenuItem { name: String::from_str(t!("mainmenu.backlighton", xous::LANG)), @@ -30,7 +31,7 @@ pub fn create_main_menu(keys: Arc>, menu_management_sid: xous::S action_opcode: com.getop_backlight(), action_payload: MenuPayload::Scalar([0, 0, 0, 0]), close_on_select: true, - }); + }); */ menuitems.push(MenuItem { name: String::from_str(t!("mainmenu.sleep", xous::LANG)), diff --git a/services/status/src/preferences.rs b/services/status/src/preferences.rs index ad6c64d7a..6c209ef96 100644 --- a/services/status/src/preferences.rs +++ b/services/status/src/preferences.rs @@ -249,11 +249,11 @@ impl DevicePrefs { impl DevicePrefs { fn autobacklight_on_boot(&mut self) -> Result<(), DevicePrefsError> { - let cv = self.up.autobacklight_on_boot_or_value(true)?; // note inversion of storage sense to make it on when false + let cv = self.up.autobacklight_on_boot_or_value(true)?; self.modals.add_list(vec![t!("prefs.yes", xous::LANG), t!("prefs.no", xous::LANG)]).unwrap(); - let new_result = yes_no_to_bool( // inversion of storage sense: false = on + let new_result = yes_no_to_bool( self.modals .get_radiobutton(&format!("{} {}", t!("prefs.current_setting", xous::LANG), bool_to_yes_no(cv))) @@ -261,12 +261,16 @@ impl DevicePrefs { .as_str(), ); - if cv { // already inverted, so the meaning is true (true is on) + if new_result { + #[cfg(not(target_os = "xous"))] + log::info!("HOSTED: enable bl"); xous::send_message(self.status_cid, xous::Message::new_scalar( crate::StatusOpcode::EnableAutomaticBacklight.to_usize().unwrap(), 0, 0, 0, 0) ).ok(); } else { + #[cfg(not(target_os = "xous"))] + log::info!("HOSTED: disable bl"); xous::send_message(self.status_cid, xous::Message::new_scalar( crate::StatusOpcode::DisableAutomaticBacklight.to_usize().unwrap(), 0, 0, 0, 0) @@ -323,9 +327,13 @@ impl DevicePrefs { .unwrap() .as_str(), ); - if cv { + if new_result { + #[cfg(not(target_os = "xous"))] + log::info!("HOSTED: killing wifi"); self.netmgr.connection_manager_wifi_off_and_stop().ok(); } else { + #[cfg(not(target_os = "xous"))] + log::info!("HOSTED: enabling wifi"); self.netmgr.connection_manager_wifi_on().ok(); }