mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-27 22:15:07 +01:00
Use zero time in init for spawn_after
to not cause panic
This commit is contained in:
parent
56d99c02bd
commit
26870ae12e
1 changed files with 6 additions and 1 deletions
|
@ -269,7 +269,12 @@ pub fn codegen(
|
||||||
where D: rtic::time::duration::Duration + rtic::time::fixed_point::FixedPoint,
|
where D: rtic::time::duration::Duration + rtic::time::fixed_point::FixedPoint,
|
||||||
D::T: Into<<#app_path::#m_mangled as rtic::time::Clock>::T>,
|
D::T: Into<<#app_path::#m_mangled as rtic::time::Clock>::T>,
|
||||||
{
|
{
|
||||||
let instant = #app_path::#m::now();
|
|
||||||
|
let instant = if rtic::export::interrupt::free(|_| unsafe { #app_path::#m_ident.is_none() }) {
|
||||||
|
rtic::time::Instant::new(0)
|
||||||
|
} else {
|
||||||
|
#app_path::#m::now()
|
||||||
|
};
|
||||||
|
|
||||||
spawn_at(instant + duration, #(,#untupled)*)
|
spawn_at(instant + duration, #(,#untupled)*)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue