bring in beats face using new time zone function
This commit is contained in:
@@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
const watch_face_t watch_faces[] = {
|
const watch_face_t watch_faces[] = {
|
||||||
simple_clock_face,
|
simple_clock_face,
|
||||||
|
beats_face,
|
||||||
world_clock_face,
|
world_clock_face,
|
||||||
countdown_face,
|
countdown_face,
|
||||||
preferences_face,
|
preferences_face,
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "simple_clock_face.h"
|
#include "simple_clock_face.h"
|
||||||
|
#include "beats_face.h"
|
||||||
#include "world_clock_face.h"
|
#include "world_clock_face.h"
|
||||||
#include "countdown_face.h"
|
#include "countdown_face.h"
|
||||||
#include "set_time_face.h"
|
#include "set_time_face.h"
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
SRCS += \
|
SRCS += \
|
||||||
./watch-faces/clock/simple_clock_face.c \
|
./watch-faces/clock/simple_clock_face.c \
|
||||||
|
./watch-faces/clock/beats_face.c \
|
||||||
./watch-faces/clock/world_clock_face.c \
|
./watch-faces/clock/world_clock_face.c \
|
||||||
./watch-faces/complication/countdown_face.c \
|
./watch-faces/complication/countdown_face.c \
|
||||||
./watch-faces/settings/set_time_face.c \
|
./watch-faces/settings/set_time_face.c \
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ bool beats_face_loop(movement_event_t event, movement_settings_t *settings, void
|
|||||||
case EVENT_ACTIVATE:
|
case EVENT_ACTIVATE:
|
||||||
case EVENT_TICK:
|
case EVENT_TICK:
|
||||||
date_time = watch_rtc_get_date_time();
|
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) {
|
if (centibeats == state->last_centibeat_displayed) {
|
||||||
// we missed this update, try again next subsecond
|
// we missed this update, try again next subsecond
|
||||||
state->next_subsecond_update = (event.subsecond + 1) % BEAT_REFRESH_FREQUENCY;
|
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);
|
sprintf(buf, "bt %6lu", centibeats);
|
||||||
|
|
||||||
watch_display_string(buf, 0);
|
watch_display_text(WATCH_POSITION_FULL, buf);
|
||||||
break;
|
break;
|
||||||
case EVENT_LOW_ENERGY_UPDATE:
|
case EVENT_LOW_ENERGY_UPDATE:
|
||||||
if (!watch_tick_animation_is_running()) watch_start_tick_animation(432);
|
if (!watch_tick_animation_is_running()) watch_start_tick_animation(432);
|
||||||
date_time = watch_rtc_get_date_time();
|
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);
|
sprintf(buf, "bt %4lu ", centibeats / 100);
|
||||||
|
|
||||||
watch_display_string(buf, 0);
|
watch_display_text(WATCH_POSITION_FULL, buf);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
movement_default_loop_handler(event, settings);
|
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);
|
uint32_t retval = seconds * 1000 + (subseconds * 1000) / (BEAT_REFRESH_FREQUENCY);
|
||||||
retval += 60 * minutes * 1000;
|
retval += 60 * minutes * 1000;
|
||||||
retval += hours * 60 * 60 * 1000;
|
retval += hours * 60 * 60 * 1000;
|
||||||
retval -= (utc_offset - 60) * 60 * 1000;
|
retval -= (utc_offset - 3600) * 1000;
|
||||||
|
|
||||||
retval /= 864; // convert to centibeats
|
retval /= 864; // convert to centibeats
|
||||||
retval %= 100000;
|
retval %= 100000;
|
||||||
Reference in New Issue
Block a user