movement: allow watch faces to request zero ticks

This commit is contained in:
Joey Castillo 2021-12-03 11:30:36 -05:00
parent b8c824419f
commit 8e2bf8591a
3 changed files with 4 additions and 3 deletions

View File

@ -104,7 +104,7 @@ void movement_request_tick_frequency(uint8_t freq) {
RTC->MODE2.INTENCLR.reg = 0xFE; // disable all callbacks except the 128 Hz one RTC->MODE2.INTENCLR.reg = 0xFE; // disable all callbacks except the 128 Hz one
movement_state.subsecond = 0; movement_state.subsecond = 0;
movement_state.tick_frequency = freq; movement_state.tick_frequency = freq;
watch_rtc_register_periodic_callback(cb_tick, freq); if (freq) watch_rtc_register_periodic_callback(cb_tick, freq);
} }
void movement_illuminate_led() { void movement_illuminate_led() {

View File

@ -18,6 +18,7 @@
const watch_face_t watch_faces[] = { const watch_face_t watch_faces[] = {
simple_clock_face, simple_clock_face,
character_set_face,
preferences_face, preferences_face,
set_time_face, set_time_face,
}; };

View File

@ -12,6 +12,7 @@ void character_set_face_activate(movement_settings_t *settings, void *context) {
(void) settings; (void) settings;
char *c = (char *)context; char *c = (char *)context;
*c = '@'; *c = '@';
movement_request_tick_frequency(0);
} }
bool character_set_face_loop(movement_event_t event, movement_settings_t *settings, void *context) { bool character_set_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
@ -33,8 +34,6 @@ bool character_set_face_loop(movement_event_t event, movement_settings_t *settin
sprintf(buf, "%c%c%c%c%c%c%c%c%c%c", *c, *c, *c, *c, *c, *c, *c, *c, *c, *c); sprintf(buf, "%c%c%c%c%c%c%c%c%c%c", *c, *c, *c, *c, *c, *c, *c, *c, *c, *c);
watch_display_string(buf, 0); watch_display_string(buf, 0);
break; break;
case EVENT_TICK:
break;
case EVENT_TIMEOUT: case EVENT_TIMEOUT:
movement_move_to_face(0); movement_move_to_face(0);
break; break;
@ -48,4 +47,5 @@ bool character_set_face_loop(movement_event_t event, movement_settings_t *settin
void character_set_face_resign(movement_settings_t *settings, void *context) { void character_set_face_resign(movement_settings_t *settings, void *context) {
(void) settings; (void) settings;
(void) context; (void) context;
movement_request_tick_frequency(1);
} }