]> git.earman.xyz Git - sensor-watch.git/commitdiff
Reduced struct memory per code review
authorDavid Volovskiy <devolov@gmail.com>
Tue, 3 Sep 2024 21:13:59 +0000 (17:13 -0400)
committerDavid Volovskiy <devolov@gmail.com>
Tue, 3 Sep 2024 21:13:59 +0000 (17:13 -0400)
movement/watch_faces/complication/endless_runner_face.h

index f9d6409b5c15c1d3af3d9f7dd00b60a6ccfebf5e..8c8fa215f9400e67e312af4840b9c658a9fd3b4e 100644 (file)
 */
 
 typedef struct {
-    // These are values that need saving between uses
-    uint32_t hi_score : 10;
-    uint32_t difficulty : 3;
-    bool soundOn;
-    uint32_t month_last_hi_score : 4;
-    uint32_t year_last_hi_score : 6;
-    uint32_t unused : 8;
+    uint16_t hi_score : 10;
+    uint8_t difficulty : 3;
+    uint8_t month_last_hi_score : 4;
+    uint8_t year_last_hi_score : 6;
+    uint8_t soundOn : 1;
+    /* 24 bits, likely aligned to 32 bits = 4 bytes */
 } endless_runner_state_t;
 
 void endless_runner_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);