create movement_get_date_time function

This commit is contained in:
joeycastillo
2022-12-23 18:37:13 -06:00
parent 283a219783
commit a6333f7b8b
25 changed files with 48 additions and 42 deletions

View File

@@ -36,7 +36,7 @@ bool beats_face_loop(movement_event_t event, movement_settings_t *settings, void
switch (event.event_type) {
case EVENT_ACTIVATE:
case EVENT_TICK:
date_time = watch_rtc_get_date_time();
date_time = movement_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]);
if (centibeats == state->last_centibeat_displayed) {
// we missed this update, try again next subsecond
@@ -51,7 +51,7 @@ bool beats_face_loop(movement_event_t event, movement_settings_t *settings, void
break;
case EVENT_LOW_ENERGY_UPDATE:
if (!watch_tick_animation_is_running()) watch_start_tick_animation(432);
date_time = watch_rtc_get_date_time();
date_time = movement_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]);
sprintf(buf, "bt %4lu ", centibeats / 100);

View File

@@ -69,7 +69,7 @@ static void _h_to_hms(mars_clock_hms_t *date_time, double h) {
static void _update(movement_settings_t *settings, mars_time_state_t *state) {
char buf[11];
watch_date_time date_time = watch_rtc_get_date_time();
watch_date_time date_time = movement_get_date_time();
uint32_t now = watch_utility_date_time_to_unix_time(date_time, movement_timezone_offsets[settings->bit.time_zone] * 60);
// TODO: I'm skipping over some steps here.
// https://www.giss.nasa.gov/tools/mars24/help/algorithm.html

View File

@@ -76,7 +76,7 @@ bool simple_clock_face_loop(movement_event_t event, movement_settings_t *setting
case EVENT_ACTIVATE:
case EVENT_TICK:
case EVENT_LOW_ENERGY_UPDATE:
date_time = watch_rtc_get_date_time();
date_time = movement_get_date_time();
previous_date_time = state->previous_date_time;
state->previous_date_time = date_time.reg;
@@ -169,7 +169,7 @@ bool simple_clock_face_wants_background_task(movement_settings_t *settings, void
simple_clock_state_t *state = (simple_clock_state_t *)context;
if (!state->signal_enabled) return false;
watch_date_time date_time = watch_rtc_get_date_time();
watch_date_time date_time = movement_get_date_time();
return date_time.unit.minute == 0;
}

View File

@@ -76,7 +76,7 @@ bool weeknumber_clock_face_loop(movement_event_t event, movement_settings_t *set
case EVENT_ACTIVATE:
case EVENT_TICK:
case EVENT_LOW_ENERGY_UPDATE:
date_time = watch_rtc_get_date_time();
date_time = movement_get_date_time();
previous_date_time = state->previous_date_time;
state->previous_date_time = date_time.reg;
@@ -165,7 +165,7 @@ bool weeknumber_clock_face_wants_background_task(movement_settings_t *settings,
weeknumber_clock_state_t *state = (weeknumber_clock_state_t *)context;
if (!state->signal_enabled) return false;
watch_date_time date_time = watch_rtc_get_date_time();
watch_date_time date_time = movement_get_date_time();
return date_time.unit.minute == 0;
}

View File

@@ -66,7 +66,7 @@ static bool world_clock_face_do_display_mode(movement_event_t event, movement_se
// fall through
case EVENT_TICK:
case EVENT_LOW_ENERGY_UPDATE:
date_time = watch_rtc_get_date_time();
date_time = movement_get_date_time();
timestamp = watch_utility_date_time_to_unix_time(date_time, movement_timezone_offsets[settings->bit.time_zone] * 60);
date_time = watch_utility_date_time_from_unix_time(timestamp, movement_timezone_offsets[state->settings.bit.timezone_index] * 60);
previous_date_time = state->previous_date_time;