refactor watch faces to use new advisory API
This commit is contained in:
@@ -153,7 +153,9 @@ void accel_interrupt_count_face_resign(void *context) {
|
||||
(void) context;
|
||||
}
|
||||
|
||||
bool accel_interrupt_count_face_wants_background_task(void *context) {
|
||||
movement_watch_face_advisory_t accel_interrupt_count_face_advise(void *context) {
|
||||
(void) context;
|
||||
return false;
|
||||
movement_watch_face_advisory_t retval = { 0 };
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -47,12 +47,12 @@ void accel_interrupt_count_face_setup(uint8_t watch_face_index, void ** context_
|
||||
void accel_interrupt_count_face_activate(void *context);
|
||||
bool accel_interrupt_count_face_loop(movement_event_t event, void *context);
|
||||
void accel_interrupt_count_face_resign(void *context);
|
||||
bool accel_interrupt_count_face_wants_background_task(void *context);
|
||||
movement_watch_face_advisory_t accel_interrupt_count_face_advise(void *context);
|
||||
|
||||
#define accel_interrupt_count_face ((const watch_face_t){ \
|
||||
accel_interrupt_count_face_setup, \
|
||||
accel_interrupt_count_face_activate, \
|
||||
accel_interrupt_count_face_loop, \
|
||||
accel_interrupt_count_face_resign, \
|
||||
accel_interrupt_count_face_wants_background_task, \
|
||||
accel_interrupt_count_face_advise, \
|
||||
})
|
||||
|
||||
@@ -143,8 +143,13 @@ void minmax_face_resign(void *context) {
|
||||
}
|
||||
|
||||
|
||||
bool minmax_face_wants_background_task(void *context) {
|
||||
movement_watch_face_advisory_t minmax_face_advise(void *context) {
|
||||
(void) context;
|
||||
|
||||
// this will get called at the top of each minute; always request bg task
|
||||
return true;
|
||||
movement_watch_face_advisory_t retval = {
|
||||
.wants_background_task = 1,
|
||||
};
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -55,14 +55,14 @@ void minmax_face_setup(uint8_t watch_face_index, void ** context_ptr);
|
||||
void minmax_face_activate(void *context);
|
||||
bool minmax_face_loop(movement_event_t event, void *context);
|
||||
void minmax_face_resign(void *context);
|
||||
bool minmax_face_wants_background_task(void *context);
|
||||
movement_watch_face_advisory_t minmax_face_advise(void *context);
|
||||
|
||||
#define minmax_face ((const watch_face_t){ \
|
||||
minmax_face_setup, \
|
||||
minmax_face_activate, \
|
||||
minmax_face_loop, \
|
||||
minmax_face_resign, \
|
||||
minmax_face_wants_background_task, \
|
||||
minmax_face_advise, \
|
||||
})
|
||||
|
||||
#endif // MINMAX_FACE_H_
|
||||
|
||||
@@ -127,9 +127,13 @@ void thermistor_logging_face_resign(void *context) {
|
||||
(void) context;
|
||||
}
|
||||
|
||||
bool thermistor_logging_face_wants_background_task(void *context) {
|
||||
movement_watch_face_advisory_t thermistor_logging_face_advise(void *context) {
|
||||
(void) context;
|
||||
movement_watch_face_advisory_t retval = { 0 };
|
||||
|
||||
// this will get called at the top of each minute, so all we check is if we're at the top of the hour as well.
|
||||
// if we are, we ask for a background task.
|
||||
return watch_rtc_get_date_time().unit.minute == 0;
|
||||
retval.wants_background_task = watch_rtc_get_date_time().unit.minute == 0;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -74,14 +74,14 @@ void thermistor_logging_face_setup(uint8_t watch_face_index, void ** context_ptr
|
||||
void thermistor_logging_face_activate(void *context);
|
||||
bool thermistor_logging_face_loop(movement_event_t event, void *context);
|
||||
void thermistor_logging_face_resign(void *context);
|
||||
bool thermistor_logging_face_wants_background_task(void *context);
|
||||
movement_watch_face_advisory_t thermistor_logging_face_advise(void *context);
|
||||
|
||||
#define thermistor_logging_face ((const watch_face_t){ \
|
||||
thermistor_logging_face_setup, \
|
||||
thermistor_logging_face_activate, \
|
||||
thermistor_logging_face_loop, \
|
||||
thermistor_logging_face_resign, \
|
||||
thermistor_logging_face_wants_background_task, \
|
||||
thermistor_logging_face_advise, \
|
||||
})
|
||||
|
||||
#endif // THERMISTOR_LOGGING_FACE_H_
|
||||
|
||||
Reference in New Issue
Block a user