mirror of
https://github.com/firewalkwithm3/Sensor-Watch.git
synced 2024-11-22 19:20:30 +08:00
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:
commit
c7413322a5
|
@ -201,7 +201,7 @@ static void _movement_handle_scheduled_tasks(void) {
|
||||||
|
|
||||||
for(uint8_t i = 0; i < MOVEMENT_NUM_FACES; i++) {
|
for(uint8_t i = 0; i < MOVEMENT_NUM_FACES; i++) {
|
||||||
if (scheduled_tasks[i].reg) {
|
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;
|
scheduled_tasks[i].reg = 0;
|
||||||
movement_event_t background_event = { EVENT_BACKGROUND_TASK, 0 };
|
movement_event_t background_event = { EVENT_BACKGROUND_TASK, 0 };
|
||||||
watch_faces[i].loop(background_event, &movement_state.settings, watch_face_contexts[i]);
|
watch_faces[i].loop(background_event, &movement_state.settings, watch_face_contexts[i]);
|
||||||
|
|
Loading…
Reference in a new issue