mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
move pddb dependencies to a feature flag for testing purposes
This commit is contained in:
parent
583198af07
commit
b18230def4
2 changed files with 13 additions and 4 deletions
|
|
@ -62,4 +62,5 @@ ditherpunk = []
|
||||||
test-rekey = []
|
test-rekey = []
|
||||||
efuse = []
|
efuse = []
|
||||||
no-codec = []
|
no-codec = []
|
||||||
|
minimal-testing = []
|
||||||
default = []
|
default = []
|
||||||
|
|
|
||||||
|
|
@ -241,6 +241,7 @@ pub fn start_time_server() {
|
||||||
move || {
|
move || {
|
||||||
let xns = xous_names::XousNames::new().unwrap();
|
let xns = xous_names::XousNames::new().unwrap();
|
||||||
let llio = llio::Llio::new(&xns);
|
let llio = llio::Llio::new(&xns);
|
||||||
|
#[cfg(not(feature="minimal-testing"))]
|
||||||
let prefs = userprefs::Manager::new();
|
let prefs = userprefs::Manager::new();
|
||||||
|
|
||||||
let tt = ticktimer_server::Ticktimer::new().unwrap();
|
let tt = ticktimer_server::Ticktimer::new().unwrap();
|
||||||
|
|
@ -253,14 +254,17 @@ pub fn start_time_server() {
|
||||||
log::trace!("start_rtc_secs: {}", start_rtc_secs);
|
log::trace!("start_rtc_secs: {}", start_rtc_secs);
|
||||||
log::trace!("start_tt_ms: {}", start_tt_ms);
|
log::trace!("start_tt_ms: {}", start_tt_ms);
|
||||||
|
|
||||||
|
#[cfg(not(feature="minimal-testing"))]
|
||||||
let pddb_poller = PddbMountPoller::new();
|
let pddb_poller = PddbMountPoller::new();
|
||||||
// enqueue a the first mount poll message
|
// enqueue a the first mount poll message
|
||||||
|
#[cfg(not(feature="minimal-testing"))]
|
||||||
xous::send_message(self_cid,
|
xous::send_message(self_cid,
|
||||||
xous::Message::new_scalar(TimeOp::PddbMountPoll.to_usize().unwrap(), 0, 0, 0, 0)
|
xous::Message::new_scalar(TimeOp::PddbMountPoll.to_usize().unwrap(), 0, 0, 0, 0)
|
||||||
).expect("couldn't check mount poll");
|
).expect("couldn't check mount poll");
|
||||||
// an initial behavior which just retuns the raw RTC time, until the PDDB is mounted.
|
// an initial behavior which just retuns the raw RTC time, until the PDDB is mounted.
|
||||||
let mut temp = 0;
|
let mut temp = 0;
|
||||||
loop {
|
loop {
|
||||||
|
#[cfg(not(feature="minimal-testing"))]
|
||||||
if pddb_poller.is_mounted_nonblocking() {
|
if pddb_poller.is_mounted_nonblocking() {
|
||||||
log::debug!("PDDB mount detected, transitioning to real-time adjusted server");
|
log::debug!("PDDB mount detected, transitioning to real-time adjusted server");
|
||||||
break;
|
break;
|
||||||
|
|
@ -311,16 +315,20 @@ pub fn start_time_server() {
|
||||||
_ => log::warn!("Time server can't handle this message yet: {:?}", msg),
|
_ => log::warn!("Time server can't handle this message yet: {:?}", msg),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(not(feature="minimal-testing"))]
|
||||||
let mut utc_offset_ms = prefs.utc_offset().unwrap_or_else(|error| {
|
let mut utc_offset_ms = prefs.utc_offset().unwrap_or_else(|error| {
|
||||||
log::error!("cannot read utc offset: {:?}", error);
|
log::error!("cannot read utc offset: {:?}", error);
|
||||||
0
|
0
|
||||||
});
|
});
|
||||||
|
#[cfg(not(feature="minimal-testing"))]
|
||||||
let mut tz_offset_ms = prefs.timezone_offset().unwrap_or_else(|error| {
|
let mut tz_offset_ms = prefs.timezone_offset().unwrap_or_else(|error| {
|
||||||
log::error!("cannot read timezone offset: {:?}", error);
|
log::error!("cannot read timezone offset: {:?}", error);
|
||||||
None
|
None
|
||||||
}).unwrap_or_default();
|
}).unwrap_or_default();
|
||||||
|
#[cfg(feature="minimal-testing")]
|
||||||
|
let mut utc_offset_ms = 0;
|
||||||
|
#[cfg(feature="minimal-testing")]
|
||||||
|
let mut tz_offset_ms = 0;
|
||||||
|
|
||||||
log::debug!("offset_key: {}", utc_offset_ms / 1000);
|
log::debug!("offset_key: {}", utc_offset_ms / 1000);
|
||||||
log::debug!("tz_key: {}", tz_offset_ms / 1000);
|
log::debug!("tz_key: {}", tz_offset_ms / 1000);
|
||||||
|
|
@ -387,7 +395,7 @@ pub fn start_time_server() {
|
||||||
utc_time_ms -
|
utc_time_ms -
|
||||||
(start_rtc_secs as i64) * 1000;
|
(start_rtc_secs as i64) * 1000;
|
||||||
utc_offset_ms = offset;
|
utc_offset_ms = offset;
|
||||||
|
#[cfg(not(feature="minimal-testing"))]
|
||||||
prefs.set_utc_offset(offset).unwrap_or_else(|err| {
|
prefs.set_utc_offset(offset).unwrap_or_else(|err| {
|
||||||
log::error!("cannot set utc offset: {:?}", err);
|
log::error!("cannot set utc offset: {:?}", err);
|
||||||
});
|
});
|
||||||
|
|
@ -402,7 +410,7 @@ pub fn start_time_server() {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
tz_offset_ms = tz_ms;
|
tz_offset_ms = tz_ms;
|
||||||
|
#[cfg(not(feature="minimal-testing"))]
|
||||||
prefs.set_timezone_offset(tz_ms).unwrap_or_else(|err| {
|
prefs.set_timezone_offset(tz_ms).unwrap_or_else(|err| {
|
||||||
log::error!("cannot set timezone offset: {:?}", err);
|
log::error!("cannot set timezone offset: {:?}", err);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue