mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
fix regression on suspend/resume on time server
seems like we're putting too much demand on the I2C bus on resume at the moment, backing off the requests a bit helps ease the logjam.
This commit is contained in:
parent
be7d8a76a5
commit
95b4df1923
1 changed files with 9 additions and 5 deletions
|
|
@ -31,7 +31,7 @@ use num_traits::*;
|
||||||
// imports for time ux
|
// imports for time ux
|
||||||
use locales::t;
|
use locales::t;
|
||||||
use chrono::prelude::*;
|
use chrono::prelude::*;
|
||||||
use xous::Message;
|
use xous::{Message, send_message};
|
||||||
use gam::modal::*;
|
use gam::modal::*;
|
||||||
// ntp imports
|
// ntp imports
|
||||||
use sntpc::{Error, NtpContext, NtpTimestampGenerator, NtpUdpSocket, Result};
|
use sntpc::{Error, NtpContext, NtpTimestampGenerator, NtpUdpSocket, Result};
|
||||||
|
|
@ -271,16 +271,20 @@ pub fn start_time_server() {
|
||||||
log::debug!("start_tt_ms: {}", start_tt_ms);
|
log::debug!("start_tt_ms: {}", start_tt_ms);
|
||||||
loop {
|
loop {
|
||||||
let msg = xous::receive_message(pub_sid).unwrap();
|
let msg = xous::receive_message(pub_sid).unwrap();
|
||||||
match FromPrimitive::from_usize(msg.body.id()) {
|
let opcode: Option<TimeOp> = FromPrimitive::from_usize(msg.body.id());
|
||||||
|
log::debug!("{:?}", opcode);
|
||||||
|
match opcode {
|
||||||
Some(TimeOp::PddbMountPoll) => {
|
Some(TimeOp::PddbMountPoll) => {
|
||||||
// do nothing, we're mounted now.
|
// do nothing, we're mounted now.
|
||||||
continue;
|
continue;
|
||||||
},
|
},
|
||||||
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, but give a little time for other processes to clear as this is not urgent
|
||||||
start_rtc_secs = llio.get_rtc_secs().expect("couldn't read RTC offset value");
|
tt.sleep_ms(180).unwrap();
|
||||||
start_tt_ms = tt.elapsed_ms();
|
send_message(self_cid,
|
||||||
|
Message::new_scalar(TimeOp::HwSync.to_usize().unwrap(), 0, 0, 0, 0)
|
||||||
|
).expect("couldn't queue sync request");
|
||||||
}),
|
}),
|
||||||
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