]> git.earman.xyz Git - sensor-watch.git/commitdiff
make the watch-face a global in movement.c, actually
authorAlex Maestas <git@se30.xyz>
Sun, 17 Dec 2023 03:23:26 +0000 (03:23 +0000)
committerAlex Maestas <git@se30.xyz>
Sun, 17 Dec 2023 03:23:26 +0000 (03:23 +0000)
movement/movement.c

index cdae9ca753c74a845f9390ad1b5835f4ff617476..05b2a078427bdeb44b19715707ae3cba60cb0abd 100644 (file)
@@ -79,6 +79,7 @@ watch_date_time scheduled_tasks[MOVEMENT_NUM_FACES];
 const int32_t movement_le_inactivity_deadlines[8] = {INT_MAX, 3600, 7200, 21600, 43200, 86400, 172800, 604800};
 const int16_t movement_timeout_inactivity_deadlines[4] = {60, 120, 300, 1800};
 movement_event_t event;
+const watch_face_t *wf;
 
 const int16_t movement_timezone_offsets[] = {
     0,      //  0 :   0:00:00 (UTC)
@@ -414,7 +415,7 @@ void app_setup(void) {
             watch_faces[i].setup(&movement_state.settings, i, &watch_face_contexts[i]);
         }
 
-        watch_faces[movement_state.current_face_idx].activate(&movement_state.settings, watch_face_contexts[movement_state.current_face_idx]);
+        wf->activate(&movement_state.settings, watch_face_contexts[movement_state.current_face_idx]);
         event.subsecond = 0;
         event.event_type = EVENT_ACTIVATE;
     }
@@ -434,7 +435,7 @@ static void _sleep_mode_app_loop(void) {
         if (movement_state.needs_background_tasks_handled) _movement_handle_background_tasks();
 
         event.event_type = EVENT_LOW_ENERGY_UPDATE;
-        watch_faces[movement_state.current_face_idx].loop(event, &movement_state.settings, watch_face_contexts[movement_state.current_face_idx]);
+        wf->loop(event, &movement_state.settings, watch_face_contexts[movement_state.current_face_idx]);
 
         // if we need to wake immediately, do it!
         if (movement_state.needs_wake) return;
@@ -444,7 +445,7 @@ static void _sleep_mode_app_loop(void) {
 }
 
 bool app_loop(void) {
-    const watch_face_t *wf = &watch_faces[movement_state.current_face_idx];
+    wf = &watch_faces[movement_state.current_face_idx];
     if (movement_state.watch_face_changed) {
         if (movement_state.settings.bit.button_should_sound) {
             // low note for nonzero case, high note for return to watch_face 0