]> git.earman.xyz Git - sensor-watch.git/commitdiff
store settings in function call, remove last uses of settings in callbacks
authorjoeycastillo <joeycastillo@utexas.edu>
Sun, 29 Sep 2024 13:57:41 +0000 (09:57 -0400)
committerjoeycastillo <joeycastillo@utexas.edu>
Sun, 29 Sep 2024 14:18:11 +0000 (10:18 -0400)
movement.c
movement.h
movement/watch_faces/settings/save_load_face.c
movement/watch_faces/settings/set_time_hackwatch_face.c
watch-faces/settings/preferences_face.c
watch-faces/settings/set_time_face.c

index 3bf006f2906ebad71f0c89149fbbd1df3c0e3e5e..b5bb640b6c0522e41c43af5b099f0980fd27f55f 100644 (file)
@@ -399,6 +399,10 @@ void movement_set_backlight_dwell(uint8_t value) {
     movement_state.settings.bit.led_duration = value;
 }
 
+void movement_store_settings(void) {
+    watch_store_backup_data(movement_state.settings.reg, 0);
+}
+
 bool movement_alarm_enabled(void) {
     return movement_state.settings.bit.alarm_enabled;
 }
index a9fa4da8d98617679982158ab488d4301c7a535f..c9128871a8b58f3ec0f851b1894ccac24c801340 100644 (file)
@@ -356,6 +356,8 @@ void movement_set_backlight_color(movement_color_t color);
 uint8_t movement_get_backlight_dwell(void);
 void movement_set_backlight_dwell(uint8_t value);
 
+void movement_store_settings(void);
+
 /// TODO: For #SecondMovement: Should we have a counter that watch faces increment when they enable an alarm, and decrement when they disable it?
 /// Or should there be a watch face function where watch faces can tell us if they have an alarm enabled?
 /// Worth considering a better way to handle this.
index 7b4be4d8765ac0fffe5c1189e1bf4eca6363d286..033587262e781bad51ab912738296cd9425d97f6 100644 (file)
@@ -48,7 +48,6 @@ static void save(save_load_state_t *state) {
 
 static void load(save_load_state_t *state, movement_settings_t *settings) {
     watch_store_backup_data(state->slot[state->index].b0, 0);
-    settings->reg = state->slot[state->index].b0;
     watch_store_backup_data(state->slot[state->index].b1, 1);
     watch_store_backup_data(state->slot[state->index].b2, 2);
     watch_store_backup_data(state->slot[state->index].b3, 3);
index 551233aebaae68092c646b28e83ca0f6d9b2631b..c27f4047011fb2d4381494091b88ee6110e51dc8 100644 (file)
@@ -267,5 +267,5 @@ void set_time_hackwatch_face_resign(movement_settings_t *settings, void *context
     (void) settings;
     (void) context;
     watch_set_led_off();
-    watch_store_backup_data(settings->reg, 0);
+    movement_store_settings();
 }
index 95da02d44287cc603842f76cfc8ddb02fa51cd20..8fc1466e0227dfb9f1f9559e94f1c4bb78b0dedb 100644 (file)
@@ -247,5 +247,5 @@ void preferences_face_resign(movement_settings_t *settings, void *context) {
     (void) settings;
     (void) context;
     movement_force_led_off();
-    watch_store_backup_data(settings->reg, 0);
+    movement_store_settings();
 }
index b8bdab10ae9e3cbc903c562938f5f36d2e3c8e2a..312a886f641d20f0a1184a46952c06052e1f79d1 100644 (file)
@@ -182,5 +182,5 @@ void set_time_face_resign(movement_settings_t *settings, void *context) {
     (void) settings;
     (void) context;
     watch_set_led_off();
-    watch_store_backup_data(settings->reg, 0);
+    movement_store_settings();
 }