refactor watch faces to use new advisory API

This commit is contained in:
joeycastillo
2024-09-29 22:14:55 -04:00
parent f843156968
commit cfd04be4fb
31 changed files with 141 additions and 88 deletions

View File

@@ -361,11 +361,15 @@ void nanosec_face_resign(void *context) {
}
// Background freq correction
bool nanosec_face_wants_background_task(void *context) {
movement_watch_face_advisory_t nanosec_face_advise(void *context) {
(void) context;
if (nanosec_state.correction_profile == 0)
return 0; // No need for background correction if we are on profile 0 - static hardware correction.
watch_date_time date_time = watch_rtc_get_date_time();
movement_watch_face_advisory_t retval = { 0 };
return date_time.unit.minute % nanosec_state.correction_cadence == 0;
// No need for background correction if we are on profile 0 - static hardware correction.
if (nanosec_state.correction_profile != 0) {
watch_date_time date_time = watch_rtc_get_date_time();
retval.wants_background_task = date_time.unit.minute % nanosec_state.correction_cadence == 0;
}
return retval;
}

View File

@@ -90,7 +90,7 @@ void nanosec_face_setup(uint8_t watch_face_index, void ** context_ptr);
void nanosec_face_activate(void *context);
bool nanosec_face_loop(movement_event_t event, void *context);
void nanosec_face_resign(void *context);
bool nanosec_face_wants_background_task(void *context);
movement_watch_face_advisory_t nanosec_face_advise(void *context);
void nanosec_ui_save(void);
void nanosec_save(void);
float nanosec_get_aging(void);
@@ -101,7 +101,7 @@ float nanosec_get_aging(void);
nanosec_face_activate, \
nanosec_face_loop, \
nanosec_face_resign, \
nanosec_face_wants_background_task, \
nanosec_face_advise, \
})
#endif // NANOSEC_FACE_H_