Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid setting an alarm in the past #1954

Merged
merged 2 commits into from
Sep 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/common/pico_time/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,13 @@ static void alarm_pool_irq_handler(void) {
index = next;
}
}
now = (int64_t) ta_time_us_64(timer);
earliest_index = pool->ordered_head;
if (earliest_index < 0) break;
// need to wait
alarm_pool_entry_t *earliest_entry = &pool->entries[earliest_index];
earliest_target = earliest_entry->target;
ta_set_timeout(timer, timer_alarm_num, earliest_target);
now = (int64_t) ta_time_us_64(timer);
peterharperuk marked this conversation as resolved.
Show resolved Hide resolved
// check we haven't now past the target time; if not we don't want to loop again
} while ((earliest_target - now) <= 0);
}
Expand Down
Loading