summaryrefslogtreecommitdiffstats
path: root/movement/watch_faces/complications/beats_face.c
diff options
context:
space:
mode:
authorJoey Castillo <joeycastillo@utexas.edu>2021-11-25 10:47:59 -0500
committerJoey Castillo <joeycastillo@utexas.edu>2021-11-25 10:47:59 -0500
commitaac7a2a85474fe70c89723a1755a2d0e74bffbaf (patch)
tree975a30e309b9964402bfd5203ebbabed9796edb9 /movement/watch_faces/complications/beats_face.c
parentb94c0ba65fa012e8f78a2b3c88878570679784f6 (diff)
downloadSensor-Watch-aac7a2a85474fe70c89723a1755a2d0e74bffbaf.tar.gz
Sensor-Watch-aac7a2a85474fe70c89723a1755a2d0e74bffbaf.tar.bz2
Sensor-Watch-aac7a2a85474fe70c89723a1755a2d0e74bffbaf.zip
movement: have beats and TOTP face use new time zone setting
Diffstat (limited to 'movement/watch_faces/complications/beats_face.c')
-rw-r--r--movement/watch_faces/complications/beats_face.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/movement/watch_faces/complications/beats_face.c b/movement/watch_faces/complications/beats_face.c
index 95a9aaef..119ddd50 100644
--- a/movement/watch_faces/complications/beats_face.c
+++ b/movement/watch_faces/complications/beats_face.c
@@ -3,7 +3,6 @@
#include "beats_face.h"
#include "watch.h"
-const uint8_t UTC_OFFSET = 4; // set to your current UTC offset to see correct beats time
const uint8_t BEAT_REFRESH_FREQUENCY = 8;
void beats_face_setup(movement_settings_t *settings, void ** context_ptr) {
@@ -29,7 +28,7 @@ bool beats_face_loop(movement_event_t event, movement_settings_t *settings, void
case EVENT_ACTIVATE:
case EVENT_TICK:
date_time = watch_rtc_get_date_time();
- beats = clock2beats(date_time.unit.hour, date_time.unit.minute, date_time.unit.second, event.subsecond, UTC_OFFSET);
+ beats = clock2beats(date_time.unit.hour, date_time.unit.minute, date_time.unit.second, event.subsecond, movement_timezone_offsets[settings->bit.time_zone]);
sprintf(buf, "bt %6.0f", beats * 100);
watch_display_string(buf, 0);
@@ -37,7 +36,7 @@ bool beats_face_loop(movement_event_t event, movement_settings_t *settings, void
case EVENT_LOW_ENERGY_UPDATE:
if (!watch_tick_animation_is_running()) watch_start_tick_animation(432);
date_time = watch_rtc_get_date_time();
- beats = clock2beats(date_time.unit.hour, date_time.unit.minute, date_time.unit.second, event.subsecond, UTC_OFFSET);
+ beats = clock2beats(date_time.unit.hour, date_time.unit.minute, date_time.unit.second, event.subsecond, movement_timezone_offsets[settings->bit.time_zone]);
sprintf(buf, "bt %4d ", (int)beats);
watch_display_string(buf, 0);
@@ -68,7 +67,7 @@ float clock2beats(uint16_t hours, uint16_t minutes, uint16_t seconds, uint16_t s
float beats = seconds + ((float)subseconds / (float)BEAT_REFRESH_FREQUENCY);
beats += 60 * minutes;
beats += (float)hours * 60 * 60;
- beats += (utc_offset + 1) * 60 * 60; // offset from utc + 1 since beats in in UTC+1
+ beats -= (utc_offset - 60) * 60; // offset from utc + 1 since beats in in UTC+1
beats /= 86.4; // convert to beats
while(beats > 1000) beats -= 1000; // beats %= 1000 but for a float