]> git.earman.xyz Git - sensor-watch.git/commitdiff
movement: allow watch faces to request zero ticks
authorJoey Castillo <joeycastillo@utexas.edu>
Fri, 3 Dec 2021 16:30:36 +0000 (11:30 -0500)
committerJoey Castillo <joeycastillo@utexas.edu>
Fri, 3 Dec 2021 16:30:36 +0000 (11:30 -0500)
movement/movement.c
movement/movement_config.h
movement/watch_faces/demos/character_set_face.c

index b41700b0935c0e0a3cd96263eb0838ea94334176..f627dbf557e8f0b8652e9ed4f950da4cdefe193b 100644 (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
     movement_state.subsecond = 0;
     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() {
index 2ef43ef024f03701c76c88817f29aa95f0a3edc2..b6b3c3503b64552c4b284823a245e2572bbbac8b 100644 (file)
@@ -18,6 +18,7 @@
 
 const watch_face_t watch_faces[] = {
     simple_clock_face,
+    character_set_face,
     preferences_face,
     set_time_face,
 };
index 7daea5a948d75f3d078fde93bd1c30c7d8825f30..eabb133f0ba1a6ce4a7004592ca3a598b8c68cc9 100644 (file)
@@ -12,6 +12,7 @@ void character_set_face_activate(movement_settings_t *settings, void *context) {
     (void) settings;
     char *c = (char *)context;
     *c = '@';
+    movement_request_tick_frequency(0);
 }
 
 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);
             watch_display_string(buf, 0);
             break;
-        case EVENT_TICK:
-            break;
         case EVENT_TIMEOUT:
             movement_move_to_face(0);
             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) settings;
     (void) context;
+    movement_request_tick_frequency(1);
 }