Add movement_cancel_background_task
Provide a way for a scheduled background task to be cancelled
This commit is contained in:
parent
311cfdb5f4
commit
37ff7b9c26
@ -157,6 +157,18 @@ void movement_schedule_background_task(watch_date_time date_time) {
|
||||
}
|
||||
}
|
||||
|
||||
void movement_cancel_background_task(void) {
|
||||
scheduled_tasks[movement_state.current_watch_face].reg = 0;
|
||||
bool other_tasks_scheduled = false;
|
||||
for(uint8_t i = 0; i < MOVEMENT_NUM_FACES; i++) {
|
||||
if (scheduled_tasks[i].reg != 0) {
|
||||
other_tasks_scheduled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
movement_state.has_scheduled_background_task = other_tasks_scheduled;
|
||||
}
|
||||
|
||||
void movement_play_signal(void) {
|
||||
watch_buzzer_play_note(BUZZER_NOTE_C8, 75);
|
||||
watch_buzzer_play_note(BUZZER_NOTE_REST, 100);
|
||||
|
@ -258,6 +258,10 @@ void movement_request_tick_frequency(uint8_t freq);
|
||||
// movement will associate the scheduled task with the currently active face.
|
||||
void movement_schedule_background_task(watch_date_time date_time);
|
||||
|
||||
// note: watch faces can only cancel their background task when in the foreground, since
|
||||
// movement will associate the scheduled task with the currently active face.
|
||||
void movement_cancel_background_task(void);
|
||||
|
||||
void movement_play_signal(void);
|
||||
void movement_play_alarm(void);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user