]> git.earman.xyz Git - sensor-watch.git/commitdiff
movement: fix off-by-one error in accelerometer test face
authorJoey Castillo <joeycastillo@utexas.edu>
Wed, 1 Dec 2021 23:57:03 +0000 (18:57 -0500)
committerJoey Castillo <joeycastillo@utexas.edu>
Wed, 1 Dec 2021 23:57:03 +0000 (18:57 -0500)
movement/watch_faces/demos/lis2dh_logging_face.c

index 367564da37e6ef732d1c099e906efd68af2375e2..0e4383cdf613607d6635aabd7f1f03eb929e01dd 100644 (file)
@@ -14,6 +14,7 @@
 
 void _lis2dh_logging_face_log_data(lis2dh_logger_state_t *logger_state) {
     watch_date_time date_time = watch_rtc_get_date_time();
+    date_time.unit.hour = (date_time.unit.hour + 23) % 24; // log this as the number of events in the previous hour
     size_t pos = logger_state->data_points % LIS2DH_LOGGING_NUM_DATA_POINTS;
     logger_state->data[pos].timestamp.reg = date_time.reg;
     logger_state->data[pos].interrupts = logger_state->interrupts_this_hour;