refactor watch faces to use new advisory API
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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_
|
||||
|
||||
Reference in New Issue
Block a user