add request_sleep function to Movement
This commit is contained in:
parent
66960fe917
commit
ff1bbfa7e6
@ -243,6 +243,15 @@ void movement_cancel_background_task_for_face(uint8_t watch_face_index) {
|
||||
movement_state.has_scheduled_background_task = other_tasks_scheduled;
|
||||
}
|
||||
|
||||
void movement_request_sleep(void) {
|
||||
/// FIXME: for #SecondMovement: This was a feature request to allow watch faces to request sleep.
|
||||
/// Setting the ticks to 1 means the watch will sleep after the next tick. I'd like to say let's
|
||||
/// set it to 0, have the watch face loop return false, and then we'll fall asleep immediately.
|
||||
/// But could this lead to a race condition where the callback decrements to -1 before the loop?
|
||||
/// This is the safest way but consider more testing here.
|
||||
movement_state.le_mode_ticks = 1;
|
||||
}
|
||||
|
||||
void movement_request_wake() {
|
||||
movement_state.needs_wake = true;
|
||||
_movement_reset_inactivity_countdown();
|
||||
|
||||
@ -314,6 +314,7 @@ void movement_cancel_background_task(void);
|
||||
void movement_schedule_background_task_for_face(uint8_t watch_face_index, watch_date_time date_time);
|
||||
void movement_cancel_background_task_for_face(uint8_t watch_face_index);
|
||||
|
||||
void movement_request_sleep(void);
|
||||
void movement_request_wake(void);
|
||||
|
||||
void movement_play_signal(void);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user