diff --git a/services/xous-ticktimer/src/main.rs b/services/xous-ticktimer/src/main.rs index e85740d6a..708bc063e 100644 --- a/services/xous-ticktimer/src/main.rs +++ b/services/xous-ticktimer/src/main.rs @@ -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 diff --git a/services/xous-ticktimer/src/platform/precursor/implementation.rs b/services/xous-ticktimer/src/platform/precursor/implementation.rs index 807fe5c25..380b8ffe7 100644 --- a/services/xous-ticktimer/src/platform/precursor/implementation.rs +++ b/services/xous-ticktimer/src/platform/precursor/implementation.rs @@ -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,