Ensure alarm is re-scheduled if timetamp is in the past

Fixes #3672
This commit is contained in:
Ulf Lilleengen 2025-01-01 19:47:39 +01:00
parent 0733bee926
commit e012e13858

View File

@ -209,6 +209,7 @@ impl RtcDriver {
let r = rtc(); let r = rtc();
loop {
let t = self.now(); let t = self.now();
if timestamp <= t { if timestamp <= t {
// If alarm timestamp has passed the alarm will not fire. // If alarm timestamp has passed the alarm will not fire.
@ -249,7 +250,12 @@ impl RtcDriver {
r.intenclr().write(|w| w.0 = compare_n(n)); r.intenclr().write(|w| w.0 = compare_n(n));
} }
true // If we have not passed the safe timestamp, we can be sure the alarm will be invoked. Otherwise,
// we need to retry setting the alarm.
if self.now() <= safe_timestamp {
return true;
}
}
} }
} }