corrections and improvements to the current PR

- set slack to 0
- change panic to advisory statement

reasons are commented in the code.
This commit is contained in:
bunnie 2023-10-10 16:35:53 +08:00
parent 18f3ac5507
commit 13e01fd823
2 changed files with 14 additions and 5 deletions

View file

@ -193,8 +193,12 @@ fn main() -> ! {
let len_after = awaiting.len();
assert!(len_before != len_after);
// As a final check, make sure the last notification is from us.
assert!(ticktimer.last_response() == sender);
// Note multiple events elapsing since the last recalculate. Theorized to be harmless.
if ticktimer.last_response() != sender {
log::warn!("Multiple events triggered before we could recalculate sleep: ticktimer.last_response() {:?} != sender {:?}; sleep_heap.len(): {}",
ticktimer.last_response(), sender, sleep_heap.len()
);
}
}
// Recalculate sleep with the newly-adjusted hash and re-enable

View file

@ -11,9 +11,14 @@ use utralib::generated::*;
use xous::definitions::MessageSender;
/// Add some slack to ensure that when we set the timeout, it
/// doesn't end up in the past due to processing latencies.
const LATENCY_SLACK_MS: i64 = 3;
/// Latency slack may be necessary for hardware implementations that can't handle
/// events that happened in the past. However, for Precursor hardware, alarms will
/// trigger based on a "less than or equal to current time" basis, so even if an
/// alarm happens in the "past" due to slippage between the current time reading
/// and the alarm setting, the alarm should still trigger.
///
/// Note that setting this number larger than 0 will degrade scheduler performance.
const LATENCY_SLACK_MS: i64 = 0;
pub struct XousTickTimer {
csr: utralib::CSR<u32>,