refactor watch faces to use new advisory API
This commit is contained in:
@@ -160,7 +160,7 @@ void decimal_time_face_resign(void *context) {
|
||||
}
|
||||
|
||||
|
||||
// void decimal_time_face_wants_background_task() {
|
||||
// void decimal_time_face_advise() {
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ void decimal_time_face_setup(uint8_t watch_face_index, void ** context_ptr);
|
||||
void decimal_time_face_activate(void *context);
|
||||
bool decimal_time_face_loop(movement_event_t event, void *context);
|
||||
void decimal_time_face_resign(void *context);
|
||||
// void decimal_time_face_wants_background_task();
|
||||
// void decimal_time_face_advise();
|
||||
|
||||
|
||||
#define decimal_time_face ((const watch_face_t){ \
|
||||
|
||||
@@ -225,11 +225,14 @@ void minute_repeater_decimal_face_resign(void *context) {
|
||||
(void) context;
|
||||
}
|
||||
|
||||
bool minute_repeater_decimal_face_wants_background_task(void *context) {
|
||||
movement_watch_face_advisory_t minute_repeater_decimal_face_advise(void *context) {
|
||||
minute_repeater_decimal_state_t *state = (minute_repeater_decimal_state_t *)context;
|
||||
if (!state->signal_enabled) return false;
|
||||
movement_watch_face_advisory_t retval = { 0 };
|
||||
|
||||
watch_date_time date_time = watch_rtc_get_date_time();
|
||||
if (state->signal_enabled) {
|
||||
watch_date_time date_time = watch_rtc_get_date_time();
|
||||
retval.wants_background_task = date_time.unit.minute == 0;
|
||||
}
|
||||
|
||||
return date_time.unit.minute == 0;
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -71,14 +71,14 @@ void minute_repeater_decimal_face_setup(uint8_t watch_face_index, void ** contex
|
||||
void minute_repeater_decimal_face_activate(void *context);
|
||||
bool minute_repeater_decimal_face_loop(movement_event_t event, void *context);
|
||||
void minute_repeater_decimal_face_resign(void *context);
|
||||
bool minute_repeater_decimal_face_wants_background_task(void *context);
|
||||
movement_watch_face_advisory_t minute_repeater_decimal_face_advise(void *context);
|
||||
|
||||
#define minute_repeater_decimal_face ((const watch_face_t){ \
|
||||
minute_repeater_decimal_face_setup, \
|
||||
minute_repeater_decimal_face_activate, \
|
||||
minute_repeater_decimal_face_loop, \
|
||||
minute_repeater_decimal_face_resign, \
|
||||
minute_repeater_decimal_face_wants_background_task, \
|
||||
minute_repeater_decimal_face_advise, \
|
||||
})
|
||||
|
||||
#endif // MINUTE_REPEATER_DECIMAL_FACE_H_
|
||||
|
||||
@@ -208,11 +208,14 @@ void repetition_minute_face_resign(void *context) {
|
||||
(void) context;
|
||||
}
|
||||
|
||||
bool repetition_minute_face_wants_background_task(void *context) {
|
||||
movement_watch_face_advisory_t repetition_minute_face_advise(void *context) {
|
||||
repetition_minute_state_t *state = (repetition_minute_state_t *)context;
|
||||
if (!state->signal_enabled) return false;
|
||||
movement_watch_face_advisory_t retval = { 0 };
|
||||
|
||||
watch_date_time date_time = watch_rtc_get_date_time();
|
||||
if (state->signal_enabled) {
|
||||
watch_date_time date_time = watch_rtc_get_date_time();
|
||||
retval.wants_background_task = date_time.unit.minute == 0;
|
||||
}
|
||||
|
||||
return date_time.unit.minute == 0;
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -70,14 +70,14 @@ void repetition_minute_face_setup(uint8_t watch_face_index, void ** context_ptr)
|
||||
void repetition_minute_face_activate(void *context);
|
||||
bool repetition_minute_face_loop(movement_event_t event, void *context);
|
||||
void repetition_minute_face_resign(void *context);
|
||||
bool repetition_minute_face_wants_background_task(void *context);
|
||||
movement_watch_face_advisory_t repetition_minute_face_advise(void *context);
|
||||
|
||||
#define repetition_minute_face ((const watch_face_t){ \
|
||||
repetition_minute_face_setup, \
|
||||
repetition_minute_face_activate, \
|
||||
repetition_minute_face_loop, \
|
||||
repetition_minute_face_resign, \
|
||||
repetition_minute_face_wants_background_task, \
|
||||
repetition_minute_face_advise, \
|
||||
})
|
||||
|
||||
#endif // REPETITION_MINUTE_FACE_H_
|
||||
|
||||
@@ -209,11 +209,14 @@ void simple_clock_bin_led_face_resign(void *context) {
|
||||
(void) context;
|
||||
}
|
||||
|
||||
bool simple_clock_bin_led_face_wants_background_task(void *context) {
|
||||
movement_watch_face_advisory_t simple_clock_bin_led_face_advise(void *context) {
|
||||
simple_clock_bin_led_state_t *state = (simple_clock_bin_led_state_t *)context;
|
||||
if (!state->signal_enabled) return false;
|
||||
movement_watch_face_advisory_t retval = { 0 };
|
||||
|
||||
watch_date_time date_time = watch_rtc_get_date_time();
|
||||
if (state->signal_enabled) {
|
||||
watch_date_time date_time = watch_rtc_get_date_time();
|
||||
retval.wants_background_task = date_time.unit.minute == 0;
|
||||
}
|
||||
|
||||
return date_time.unit.minute == 0;
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -68,14 +68,14 @@ void simple_clock_bin_led_face_setup(uint8_t watch_face_index, void ** context_p
|
||||
void simple_clock_bin_led_face_activate(void *context);
|
||||
bool simple_clock_bin_led_face_loop(movement_event_t event, void *context);
|
||||
void simple_clock_bin_led_face_resign(void *context);
|
||||
bool simple_clock_bin_led_face_wants_background_task(void *context);
|
||||
movement_watch_face_advisory_t simple_clock_bin_led_face_advise(void *context);
|
||||
|
||||
#define simple_clock_bin_led_face ((const watch_face_t){ \
|
||||
simple_clock_bin_led_face_setup, \
|
||||
simple_clock_bin_led_face_activate, \
|
||||
simple_clock_bin_led_face_loop, \
|
||||
simple_clock_bin_led_face_resign, \
|
||||
simple_clock_bin_led_face_wants_background_task, \
|
||||
simple_clock_bin_led_face_advise, \
|
||||
})
|
||||
|
||||
#endif // SIIMPLE_CLOCK_BIN_LED_FACE_H_
|
||||
|
||||
@@ -143,11 +143,14 @@ void weeknumber_clock_face_resign(void *context) {
|
||||
(void) context;
|
||||
}
|
||||
|
||||
bool weeknumber_clock_face_wants_background_task(void *context) {
|
||||
movement_watch_face_advisory_t weeknumber_clock_face_advise(void *context) {
|
||||
weeknumber_clock_state_t *state = (weeknumber_clock_state_t *)context;
|
||||
if (!state->signal_enabled) return false;
|
||||
movement_watch_face_advisory_t retval = { 0 };
|
||||
|
||||
watch_date_time date_time = watch_rtc_get_date_time();
|
||||
if (state->signal_enabled) {
|
||||
watch_date_time date_time = watch_rtc_get_date_time();
|
||||
retval.wants_background_task = date_time.unit.minute == 0;
|
||||
}
|
||||
|
||||
return date_time.unit.minute == 0;
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -48,14 +48,14 @@ void weeknumber_clock_face_setup(uint8_t watch_face_index, void ** context_ptr);
|
||||
void weeknumber_clock_face_activate(void *context);
|
||||
bool weeknumber_clock_face_loop(movement_event_t event, void *context);
|
||||
void weeknumber_clock_face_resign(void *context);
|
||||
bool weeknumber_clock_face_wants_background_task(void *context);
|
||||
movement_watch_face_advisory_t weeknumber_clock_face_advise(void *context);
|
||||
|
||||
#define weeknumber_clock_face ((const watch_face_t){ \
|
||||
weeknumber_clock_face_setup, \
|
||||
weeknumber_clock_face_activate, \
|
||||
weeknumber_clock_face_loop, \
|
||||
weeknumber_clock_face_resign, \
|
||||
weeknumber_clock_face_wants_background_task, \
|
||||
weeknumber_clock_face_advise, \
|
||||
})
|
||||
|
||||
#endif // SIMPLE_CLOCK_FACE_H_
|
||||
|
||||
@@ -77,7 +77,7 @@ void wyoscan_face_setup(uint8_t watch_face_index, void ** context_ptr);
|
||||
void wyoscan_face_activate(void *context);
|
||||
bool wyoscan_face_loop(movement_event_t event, void *context);
|
||||
void wyoscan_face_resign(void *context);
|
||||
bool wyoscan_face_wants_background_task(void *context);
|
||||
movement_watch_face_advisory_t wyoscan_face_advise(void *context);
|
||||
|
||||
#define wyoscan_face ((const watch_face_t){ \
|
||||
wyoscan_face_setup, \
|
||||
|
||||
Reference in New Issue
Block a user