this should fix the issue on #382. The behavior is now:

*device not plugged in*

1. select "Lock device (reboot)"
2. device reboots
3. device goes to sleep
4. user wakes up the device
5. user is challenged with the unlock PIN

*device is plugged in*

1. select "Lock device (reboot)"
2. device reboots
3. user is challenged with the unlock PIN

I think this should be the "least surprising" outcome given
the description of the menu item.
This commit is contained in:
bunnie 2023-05-21 18:25:27 +08:00
parent d1af22f861
commit fe646f52c1

View file

@ -634,18 +634,16 @@ fn wrapped_main() -> ! {
// reset it for good measure
early_settings.set_early_sleep(false).unwrap();
while ((llio.adc_vbus().unwrap() as u32) * 503) > 150_000 {
modals.show_notification(t!("mainmenu.cant_sleep", xous::LANG), None).expect("couldn't notify that power is plugged in");
}
match susres.initiate_suspend() {
Ok(_) => {},
Err(xous::Error::Timeout) => {
// TODO: maybe this branch needs a different log message/flow?
modals.show_notification(t!("suspend.fail", xous::LANG), None).unwrap();
}
Err(_e) => {
panic!("Unhandled error on suspend request");
if ((llio.adc_vbus().unwrap() as u32) * 503) <= 150_000 {
match susres.initiate_suspend() {
Ok(_) => {},
Err(xous::Error::Timeout) => {
// TODO: maybe this branch needs a different log message/flow?
modals.show_notification(t!("suspend.fail", xous::LANG), None).unwrap();
}
Err(_e) => {
panic!("Unhandled error on suspend request");
}
}
}
}