]> git.earman.xyz Git - sensor-watch.git/commitdiff
movement: add option to always snap back to first watch face
authorJoey Castillo <joeycastillo@utexas.edu>
Thu, 2 Dec 2021 20:10:49 +0000 (15:10 -0500)
committerJoey Castillo <joeycastillo@utexas.edu>
Thu, 2 Dec 2021 20:10:49 +0000 (15:10 -0500)
movement/movement.c
movement/movement.h

index 2ac31a966c5c3bd2a73b64e2d05e81a3e341ee20..b41700b0935c0e0a3cd96263eb0838ea94334176 100644 (file)
@@ -265,10 +265,17 @@ bool app_loop() {
     // if we have timed out of our timeout countdown, give the app a hint that they can resign.
     if (movement_state.timeout_ticks == 0) {
         movement_state.timeout_ticks = -1;
-        event.event_type = EVENT_TIMEOUT;
+        if (movement_state.settings.bit.to_always == false) {
+            // if "timeout always" is false, give the current watch face a chance to exit gracefully...
+            event.event_type = EVENT_TIMEOUT;
+        }
         event.subsecond = movement_state.subsecond;
         watch_faces[movement_state.current_watch_face].loop(event, &movement_state.settings, watch_face_contexts[movement_state.current_watch_face]);
         event.event_type = EVENT_NONE;
+        if (movement_state.settings.bit.to_always && movement_state.current_watch_face != 0) {
+            // ...but if the user has "timeout always" set, give it the boot.
+            movement_move_to_face(0);
+        }
     }
 
     // Now that we've handled all display update tasks, handle the alarm.
index 9fa540ca48aaf3bfbdcf6bfa65492cc663e0c3f7..d93d934eb54d956416d60c9d306ecc5cc2cea512 100644 (file)
@@ -23,6 +23,7 @@ typedef union {
     struct {
         bool button_should_sound : 1;       // if true, pressing a button emits a sound.
         uint8_t to_interval : 2;            // an inactivity interval for asking the active face to resign.
+        bool to_always : 1;                 // if true, always time out from the active face to face 0. otherwise only faces that time out will resign (the default).
         uint8_t le_interval : 3;            // 0 to disable low energy mode, or an inactivity interval for going into low energy mode.
         uint8_t led_duration : 2;           // how many seconds to shine the LED for (x2), or 0 to disable it.
         uint8_t led_red_color : 4;          // for general purpose illumination, the red LED value (0-15)
@@ -35,7 +36,7 @@ typedef union {
         // altimeter to display feet or meters as easily as it tells a thermometer to display degrees in F or C.
         bool clock_mode_24h : 1;            // indicates whether clock should use 12 or 24 hour mode.
         bool use_imperial_units : 1;        // indicates whether to use metric units (the default) or imperial.
-        uint8_t reserved : 8;               // room for more preferences if needed.
+        uint8_t reserved : 7;               // room for more preferences if needed.
     } bit;
     uint32_t reg;
 } movement_settings_t;