mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
improve resume error handling in the time block
This commit is contained in:
parent
a05f9a5c92
commit
5847cb04cf
1 changed files with 19 additions and 2 deletions
|
|
@ -204,8 +204,25 @@ pub fn start_time_server() {
|
||||||
Some(TimeOp::SusRes) => xous::msg_scalar_unpack!(msg, token, _, _, _, {
|
Some(TimeOp::SusRes) => xous::msg_scalar_unpack!(msg, token, _, _, _, {
|
||||||
susres.suspend_until_resume(token).expect("couldn't execute suspend/resume");
|
susres.suspend_until_resume(token).expect("couldn't execute suspend/resume");
|
||||||
// resync time on resume
|
// resync time on resume
|
||||||
start_rtc_secs = llio.get_rtc_secs().expect("couldn't read RTC offset value");
|
let mut count = 0;
|
||||||
start_tt_ms = tt.elapsed_ms();
|
loop {
|
||||||
|
match llio.get_rtc_secs() {
|
||||||
|
Ok(secs) => {
|
||||||
|
start_rtc_secs = secs;
|
||||||
|
start_tt_ms = tt.elapsed_ms();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
log::warn!("RTC read yielded error; retrying: {:?}", e);
|
||||||
|
tt.sleep_ms(850).unwrap();
|
||||||
|
count += 1;
|
||||||
|
if count > 5 {
|
||||||
|
// this should be a panic, I think, not an abort.
|
||||||
|
panic!("Couldn't sync time on resume. Something went wrong with the RTC hardware.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
Some(TimeOp::HwSync) => {
|
Some(TimeOp::HwSync) => {
|
||||||
start_rtc_secs = llio.get_rtc_secs().expect("couldn't read RTC offset value");
|
start_rtc_secs = llio.get_rtc_secs().expect("couldn't read RTC offset value");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue