Merge PR #439 - fix scheduled task misses

The movement was checking for scheduled tasks
by comparing for equality their scheduled times to
the current time. However, it is possible that the time
has moved past the scheduled time by the time the
function executes, leading to scheduled tasks not
being executed and therefore to missed deadlines.

Changing it to `<=` fixes the problem by taking that
possibility into account.

Helped-by: Wesley Ellis <tahnok@gmail.com>
Reviewed-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/439
This commit is contained in:
Matheus Moreira 2024-08-26 09:14:29 -03:00 committed by Matheus Afonso Martins Moreira
commit c7413322a5

View file

@ -201,7 +201,7 @@ static void _movement_handle_scheduled_tasks(void) {
for(uint8_t i = 0; i < MOVEMENT_NUM_FACES; i++) {
if (scheduled_tasks[i].reg) {
if (scheduled_tasks[i].reg == date_time.reg) {
if (scheduled_tasks[i].reg <= date_time.reg) {
scheduled_tasks[i].reg = 0;
movement_event_t background_event = { EVENT_BACKGROUND_TASK, 0 };
watch_faces[i].loop(background_event, &movement_state.settings, watch_face_contexts[i]);