bring in beats face using new time zone function

This commit is contained in:
joeycastillo 2024-09-29 09:17:06 -04:00
parent 1c2f1bad5d
commit 677872434d
5 changed files with 8 additions and 5 deletions

View File

@ -29,6 +29,7 @@
const watch_face_t watch_faces[] = {
simple_clock_face,
beats_face,
world_clock_face,
countdown_face,
preferences_face,

View File

@ -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"

View File

@ -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 \

View File

@ -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;