From: Joey Castillo Date: Wed, 1 Dec 2021 23:57:03 +0000 (-0500) Subject: movement: fix off-by-one error in accelerometer test face X-Git-Url: https://git.earman.xyz/?a=commitdiff_plain;h=8723c70033b8b62151a7fd25a7671ff2359b9d88;p=sensor-watch.git movement: fix off-by-one error in accelerometer test face --- diff --git a/movement/watch_faces/demos/lis2dh_logging_face.c b/movement/watch_faces/demos/lis2dh_logging_face.c index 367564d..0e4383c 100644 --- a/movement/watch_faces/demos/lis2dh_logging_face.c +++ b/movement/watch_faces/demos/lis2dh_logging_face.c @@ -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;