From 677872434d1984eb54d2755a4b306e5a9b104606 Mon Sep 17 00:00:00 2001 From: joeycastillo Date: Sun, 29 Sep 2024 09:17:06 -0400 Subject: [PATCH] bring in beats face using new time zone function --- movement_config.h | 1 + movement_faces.h | 1 + watch-faces.mk | 1 + .../watch_faces => watch-faces}/clock/beats_face.c | 10 +++++----- .../watch_faces => watch-faces}/clock/beats_face.h | 0 5 files changed, 8 insertions(+), 5 deletions(-) rename {movement/watch_faces => watch-faces}/clock/beats_face.c (94%) rename {movement/watch_faces => watch-faces}/clock/beats_face.h (100%) diff --git a/movement_config.h b/movement_config.h index f5c7a2cf..2ad4cdba 100644 --- a/movement_config.h +++ b/movement_config.h @@ -29,6 +29,7 @@ const watch_face_t watch_faces[] = { simple_clock_face, + beats_face, world_clock_face, countdown_face, preferences_face, diff --git a/movement_faces.h b/movement_faces.h index 61d2f37c..5ea739a4 100644 --- a/movement_faces.h +++ b/movement_faces.h @@ -25,6 +25,7 @@ #pragma once #include "simple_clock_face.h" +#include "beats_face.h" #include "world_clock_face.h" #include "countdown_face.h" #include "set_time_face.h" diff --git a/watch-faces.mk b/watch-faces.mk index 52407820..734560da 100644 --- a/watch-faces.mk +++ b/watch-faces.mk @@ -1,5 +1,6 @@ SRCS += \ ./watch-faces/clock/simple_clock_face.c \ + ./watch-faces/clock/beats_face.c \ ./watch-faces/clock/world_clock_face.c \ ./watch-faces/complication/countdown_face.c \ ./watch-faces/settings/set_time_face.c \ diff --git a/movement/watch_faces/clock/beats_face.c b/watch-faces/clock/beats_face.c similarity index 94% rename from movement/watch_faces/clock/beats_face.c rename to watch-faces/clock/beats_face.c index 85bcbe08..9a9ffb94 100644 --- a/movement/watch_faces/clock/beats_face.c +++ b/watch-faces/clock/beats_face.c @@ -61,7 +61,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(); - centibeats = clock2beats(date_time.unit.hour, date_time.unit.minute, date_time.unit.second, event.subsecond, movement_timezone_offsets[settings->bit.time_zone]); + centibeats = clock2beats(date_time.unit.hour, date_time.unit.minute, date_time.unit.second, event.subsecond, movement_get_current_timezone_offset()); if (centibeats == state->last_centibeat_displayed) { // we missed this update, try again next subsecond state->next_subsecond_update = (event.subsecond + 1) % BEAT_REFRESH_FREQUENCY; @@ -71,15 +71,15 @@ bool beats_face_loop(movement_event_t event, movement_settings_t *settings, void } sprintf(buf, "bt %6lu", centibeats); - watch_display_string(buf, 0); + watch_display_text(WATCH_POSITION_FULL, buf); break; case EVENT_LOW_ENERGY_UPDATE: if (!watch_tick_animation_is_running()) watch_start_tick_animation(432); date_time = watch_rtc_get_date_time(); - centibeats = clock2beats(date_time.unit.hour, date_time.unit.minute, date_time.unit.second, event.subsecond, movement_timezone_offsets[settings->bit.time_zone]); + centibeats = clock2beats(date_time.unit.hour, date_time.unit.minute, date_time.unit.second, event.subsecond, movement_get_current_timezone_offset()); sprintf(buf, "bt %4lu ", centibeats / 100); - watch_display_string(buf, 0); + watch_display_text(WATCH_POSITION_FULL, buf); break; default: movement_default_loop_handler(event, settings); @@ -98,7 +98,7 @@ uint32_t clock2beats(uint32_t hours, uint32_t minutes, uint32_t seconds, uint32_ uint32_t retval = seconds * 1000 + (subseconds * 1000) / (BEAT_REFRESH_FREQUENCY); retval += 60 * minutes * 1000; retval += hours * 60 * 60 * 1000; - retval -= (utc_offset - 60) * 60 * 1000; + retval -= (utc_offset - 3600) * 1000; retval /= 864; // convert to centibeats retval %= 100000; diff --git a/movement/watch_faces/clock/beats_face.h b/watch-faces/clock/beats_face.h similarity index 100% rename from movement/watch_faces/clock/beats_face.h rename to watch-faces/clock/beats_face.h