mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
Merge branch 'main' of github.com:betrusted-io/xous-core
This commit is contained in:
commit
97ac5e1cd6
3 changed files with 27 additions and 0 deletions
|
|
@ -114,6 +114,12 @@
|
||||||
"zh": "键盘布局...",
|
"zh": "键盘布局...",
|
||||||
"en-tts": "Keyboard layout submenu"
|
"en-tts": "Keyboard layout submenu"
|
||||||
},
|
},
|
||||||
|
"mainmenu.battery_disconnect": {
|
||||||
|
"en": "Disconnect battery",
|
||||||
|
"ja": "バッテリーを外します",
|
||||||
|
"zh": "断开电池",
|
||||||
|
"en-tts": "Disconnect battery"
|
||||||
|
},
|
||||||
"mainmenu.reboot": {
|
"mainmenu.reboot": {
|
||||||
"en": "Reboot",
|
"en": "Reboot",
|
||||||
"ja": "リブート",
|
"ja": "リブート",
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,8 @@ pub(crate) enum StatusOpcode {
|
||||||
|
|
||||||
/// Suspend handler from the main menu
|
/// Suspend handler from the main menu
|
||||||
TrySuspend,
|
TrySuspend,
|
||||||
|
/// Ship mode handler for the main menu
|
||||||
|
BatteryDisconnect,
|
||||||
/// for returning wifi stats
|
/// for returning wifi stats
|
||||||
WifiStats,
|
WifiStats,
|
||||||
Quit,
|
Quit,
|
||||||
|
|
@ -756,6 +758,18 @@ fn xmain() -> ! {
|
||||||
susres.initiate_suspend().expect("couldn't initiate suspend op");
|
susres.initiate_suspend().expect("couldn't initiate suspend op");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Some(StatusOpcode::BatteryDisconnect) => {
|
||||||
|
if ((llio.adc_vbus().unwrap() as f64) * 0.005033) > 1.5 {
|
||||||
|
modals.show_notification(t!("mainmenu.cant_sleep", xous::LANG)).expect("couldn't notify that power is plugged in");
|
||||||
|
} else {
|
||||||
|
gam.shipmode_blank_request().ok();
|
||||||
|
ticktimer.sleep_ms(500).unwrap();
|
||||||
|
llio.allow_ec_snoop(true).unwrap();
|
||||||
|
llio.allow_power_off(true).unwrap();
|
||||||
|
com.ship_mode().unwrap();
|
||||||
|
com.power_off_soc().unwrap();
|
||||||
|
}
|
||||||
|
},
|
||||||
Some(StatusOpcode::Quit) => {
|
Some(StatusOpcode::Quit) => {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,13 @@ pub fn create_main_menu(keys: Arc<Mutex<RootKeys>>, status_conn: xous::CID, com:
|
||||||
action_payload: MenuPayload::Scalar([0, 0, 0, 0]),
|
action_payload: MenuPayload::Scalar([0, 0, 0, 0]),
|
||||||
close_on_select: true,
|
close_on_select: true,
|
||||||
});
|
});
|
||||||
|
menuitems.push(MenuItem {
|
||||||
|
name: String::from_str(t!("mainmenu.battery_disconnect", xous::LANG)),
|
||||||
|
action_conn: Some(status_conn),
|
||||||
|
action_opcode: StatusOpcode::BatteryDisconnect.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.closemenu", xous::LANG)),
|
name: String::from_str(t!("mainmenu.closemenu", xous::LANG)),
|
||||||
action_conn: None,
|
action_conn: None,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue