]> git.earman.xyz Git - sensor-watch.git/commitdiff
allow setting default LED colors in movement_config
authorjoeycastillo <joeycastillo@utexas.edu>
Mon, 28 Nov 2022 17:43:51 +0000 (11:43 -0600)
committerjoeycastillo <joeycastillo@utexas.edu>
Mon, 28 Nov 2022 17:43:51 +0000 (11:43 -0600)
movement/alt_fw/the_stargazer.h
movement/movement.c

index 50a89aad538f67b4029d396307a8508d48d970d8..a13dc3aca17246b224e106a6116131464025818a 100644 (file)
 
 #include "movement_faces.h"
 
-#define MOVEMENT_CUSTOM_BOOT_COMMANDS() { \
-    movement_state.settings.bit.led_green_color = 0x0;\
-    movement_state.settings.bit.led_red_color = 0xF;\
-    watch_store_backup_data(movement_state.settings.reg, 0);\
-}
+#define MOVEMENT_DEFAULT_RED_COLOR 0xF
+#define MOVEMENT_DEFAULT_GREEN_COLOR 0x0
 
 const watch_face_t watch_faces[] = {
     simple_clock_face,
index 0ded11e3f4c25c5c1b46fc38232522e3514a91b8..25fa2c5c709abd2a6ebb5dc43ca886c688a488f9 100644 (file)
 #define MOVEMENT_SECONDARY_FACE_INDEX 0
 #endif
 
+// Set default LED colors if not set
+#ifndef MOVEMENT_DEFAULT_RED_COLOR
+#define MOVEMENT_DEFAULT_RED_COLOR 0x0
+#endif
+#ifndef MOVEMENT_DEFAULT_GREEN_COLOR
+#define MOVEMENT_DEFAULT_GREEN_COLOR 0xF
+#endif
+
 #if __EMSCRIPTEN__
 #include <emscripten.h>
 #endif
@@ -284,7 +292,8 @@ uint8_t movement_claim_backup_register(void) {
 void app_init(void) {
     memset(&movement_state, 0, sizeof(movement_state));
 
-    movement_state.settings.bit.led_green_color = 0xF;
+    movement_state.settings.bit.led_red_color = MOVEMENT_DEFAULT_RED_COLOR;
+    movement_state.settings.bit.led_green_color = MOVEMENT_DEFAULT_GREEN_COLOR;
     movement_state.settings.bit.button_should_sound = true;
     movement_state.settings.bit.le_interval = 1;
     movement_state.settings.bit.led_duration = 1;