summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--movement/movement.c12
-rw-r--r--movement/movement.h4
2 files changed, 16 insertions, 0 deletions
diff --git a/movement/movement.c b/movement/movement.c
index 3e22ace5..cde6b24c 100644
--- a/movement/movement.c
+++ b/movement/movement.c
@@ -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);
diff --git a/movement/movement.h b/movement/movement.h
index edb1fabc..3706b8db 100644
--- a/movement/movement.h
+++ b/movement/movement.h
@@ -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);