]> git.earman.xyz Git - sensor-watch.git/commitdiff
make 2022 the default year
authorJoey Castillo <joeycastillo@utexas.edu>
Thu, 21 Apr 2022 18:12:16 +0000 (14:12 -0400)
committerJoey Castillo <joeycastillo@utexas.edu>
Thu, 21 Apr 2022 18:18:17 +0000 (14:18 -0400)
watch-library/hardware/main.c

index eb372cc4ad8ef863106fe1a50f5e3f612f65ec7b..d1eee16877f6d70d4bff9e1cc18f112b2b841097 100755 (executable)
@@ -66,6 +66,13 @@ int main(void) {
     // Watch library code. Set initial parameters for the device and enable the RTC.
     _watch_init();
 
+    // if date/time register is 0 (power on reset state), default year to 2022.
+    watch_date_time date_time = watch_rtc_get_date_time();
+    if (date_time.reg == 0) {
+        date_time.unit.year = 2;
+        watch_rtc_set_date_time(date_time);
+    }
+
     // User code. Give the app a chance to enable and set up peripherals.
     app_setup();