use consistent naming style for typedefs

This commit is contained in:
joeycastillo
2024-10-05 10:31:17 -04:00
parent 997f091c16
commit 0a9d71e2d4
70 changed files with 222 additions and 222 deletions

View File

@@ -53,7 +53,7 @@ bool beats_face_loop(movement_event_t event, void *context) {
char buf[16];
uint32_t centibeats;
watch_date_time date_time;
watch_date_time_t date_time;
switch (event.event_type) {
case EVENT_ACTIVATE:
case EVENT_TICK:

View File

@@ -44,7 +44,7 @@
typedef struct {
struct {
watch_date_time previous;
watch_date_time_t previous;
} date_time;
uint8_t last_battery_check;
uint8_t watch_face_index;
@@ -72,11 +72,11 @@ static void clock_indicate_24h() {
clock_indicate(WATCH_INDICATOR_24H, !!movement_clock_mode_24h());
}
static bool clock_is_pm(watch_date_time date_time) {
static bool clock_is_pm(watch_date_time_t date_time) {
return date_time.unit.hour >= 12;
}
static void clock_indicate_pm(watch_date_time date_time) {
static void clock_indicate_pm(watch_date_time_t date_time) {
if (movement_clock_mode_24h()) { return; }
clock_indicate(WATCH_INDICATOR_PM, clock_is_pm(date_time));
}
@@ -86,7 +86,7 @@ static void clock_indicate_low_available_power(clock_state_t *clock) {
clock_indicate(WATCH_INDICATOR_LAP, clock->battery_low);
}
static watch_date_time clock_24h_to_12h(watch_date_time date_time) {
static watch_date_time_t clock_24h_to_12h(watch_date_time_t date_time) {
date_time.unit.hour %= 12;
if (date_time.unit.hour == 0) {
@@ -96,7 +96,7 @@ static watch_date_time clock_24h_to_12h(watch_date_time date_time) {
return date_time;
}
static void clock_check_battery_periodically(clock_state_t *clock, watch_date_time date_time) {
static void clock_check_battery_periodically(clock_state_t *clock, watch_date_time_t date_time) {
// check the battery voltage once a day
if (date_time.unit.day == clock->last_battery_check) { return; }
@@ -116,7 +116,7 @@ static void clock_toggle_time_signal(clock_state_t *clock) {
clock_indicate_time_signal(clock);
}
static void clock_display_all(watch_date_time date_time) {
static void clock_display_all(watch_date_time_t date_time) {
char buf[8 + 1];
snprintf(
@@ -134,7 +134,7 @@ static void clock_display_all(watch_date_time date_time) {
watch_display_text(WATCH_POSITION_BOTTOM, buf + 2);
}
static bool clock_display_some(watch_date_time current, watch_date_time previous) {
static bool clock_display_some(watch_date_time_t current, watch_date_time_t previous) {
if ((current.reg >> 6) == (previous.reg >> 6)) {
// everything before seconds is the same, don't waste cycles setting those segments.
@@ -167,7 +167,7 @@ static bool clock_display_some(watch_date_time current, watch_date_time previous
}
}
static void clock_display_clock(clock_state_t *clock, watch_date_time current) {
static void clock_display_clock(clock_state_t *clock, watch_date_time_t current) {
if (!clock_display_some(current, clock->date_time.previous)) {
if (movement_clock_mode_24h() == MOVEMENT_CLOCK_MODE_12H) {
clock_indicate_pm(current);
@@ -177,7 +177,7 @@ static void clock_display_clock(clock_state_t *clock, watch_date_time current) {
}
}
static void clock_display_low_energy(watch_date_time date_time) {
static void clock_display_low_energy(watch_date_time_t date_time) {
if (movement_clock_mode_24h() == MOVEMENT_CLOCK_MODE_12H) {
clock_indicate_pm(date_time);
date_time = clock_24h_to_12h(date_time);
@@ -240,7 +240,7 @@ void clock_face_activate(void *context) {
bool clock_face_loop(movement_event_t event, void *context) {
clock_state_t *state = (clock_state_t *) context;
watch_date_time current;
watch_date_time_t current;
switch (event.event_type) {
case EVENT_LOW_ENERGY_UPDATE:
@@ -282,7 +282,7 @@ movement_watch_face_advisory_t clock_face_advise(void *context) {
clock_state_t *state = (clock_state_t *) context;
if (state->time_signal_enabled) {
watch_date_time date_time = movement_get_local_date_time();
watch_date_time_t date_time = movement_get_local_date_time();
retval.wants_background_task = date_time.unit.minute == 0;
}

View File

@@ -58,7 +58,7 @@ static bool world_clock_face_do_display_mode(movement_event_t event, world_clock
char buf[11];
uint32_t previous_date_time;
watch_date_time date_time;
watch_date_time_t date_time;
switch (event.event_type) {
case EVENT_ACTIVATE:
if (movement_clock_mode_24h()) watch_set_indicator(WATCH_INDICATOR_24H);

View File

@@ -54,7 +54,7 @@ static const uint8_t _buzzer_segdata[3][2] = {{0, 3}, {1, 3}, {2, 2}};
static int8_t _wait_ticks;
static uint8_t _get_weekday_idx(watch_date_time date_time) {
static uint8_t _get_weekday_idx(watch_date_time_t date_time) {
date_time.unit.year += 20;
if (date_time.unit.month <= 2) {
date_time.unit.month += 12;
@@ -143,7 +143,7 @@ static void _alarm_resume_setting(alarm_state_t *state, uint8_t subsecond) {
static void _alarm_update_alarm_enabled(alarm_state_t *state) {
// save indication for active alarms to movement settings
bool active_alarms = false;
watch_date_time now;
watch_date_time_t now;
bool now_init = false;
uint8_t weekday_idx;
uint16_t now_minutes_of_day;
@@ -244,7 +244,7 @@ movement_watch_face_advisory_t advanced_alarm_face_advise(void *context) {
alarm_state_t *state = (alarm_state_t *)context;
movement_watch_face_advisory_t retval = { 0 };
watch_date_time now = movement_get_local_date_time();
watch_date_time_t now = movement_get_local_date_time();
// just a failsafe: never fire more than one alarm within a minute
if (state->alarm_handled_minute == now.unit.minute) return retval;
state->alarm_handled_minute = now.unit.minute;

View File

@@ -72,7 +72,7 @@ static void schedule_countdown(countdown_state_t *state) {
uint32_t new_now = watch_utility_date_time_to_unix_time(movement_get_utc_date_time(), movement_get_current_timezone_offset());
state->target_ts = watch_utility_offset_timestamp(new_now, state->hours, state->minutes, state->seconds);
state->now_ts = new_now;
watch_date_time target_dt = watch_utility_date_time_from_unix_time(state->target_ts, movement_get_current_timezone_offset());
watch_date_time_t target_dt = watch_utility_date_time_from_unix_time(state->target_ts, movement_get_current_timezone_offset());
movement_schedule_background_task_for_face(state->watch_face_index, target_dt);
}
@@ -196,7 +196,7 @@ void countdown_face_setup(uint8_t watch_face_index, void ** context_ptr) {
void countdown_face_activate(void *context) {
countdown_state_t *state = (countdown_state_t *)context;
if(state->mode == cd_running) {
watch_date_time now = movement_get_utc_date_time();
watch_date_time_t now = movement_get_utc_date_time();
state->now_ts = watch_utility_date_time_to_unix_time(now, movement_get_current_timezone_offset());
watch_set_indicator(WATCH_INDICATOR_SIGNAL);
}

View File

@@ -48,7 +48,7 @@
#endif
// distant future for background task: January 1, 2083
static const watch_date_time distant_future = {
static const watch_date_time_t distant_future = {
.unit = {0, 0, 0, 1, 1, 63}
};

View File

@@ -39,7 +39,7 @@
static const uint8_t _location_count = sizeof(longLatPresets) / sizeof(long_lat_presets_t);
static void _sunrise_sunset_set_expiration(sunrise_sunset_state_t *state, watch_date_time next_rise_set) {
static void _sunrise_sunset_set_expiration(sunrise_sunset_state_t *state, watch_date_time_t next_rise_set) {
uint32_t timestamp = watch_utility_date_time_to_unix_time(next_rise_set, 0);
state->rise_set_expires = watch_utility_date_time_from_unix_time(timestamp + 60, 0);
}
@@ -62,9 +62,9 @@ static void _sunrise_sunset_face_update(sunrise_sunset_state_t *state) {
return;
}
watch_date_time date_time = movement_get_local_date_time(); // the current local date / time
watch_date_time utc_now = watch_utility_date_time_convert_zone(date_time, movement_get_current_timezone_offset(), 0); // the current date / time in UTC
watch_date_time scratch_time; // scratchpad, contains different values at different times
watch_date_time_t date_time = movement_get_local_date_time(); // the current local date / time
watch_date_time_t utc_now = watch_utility_date_time_convert_zone(date_time, movement_get_current_timezone_offset(), 0); // the current date / time in UTC
watch_date_time_t scratch_time; // scratchpad, contains different values at different times
scratch_time.reg = utc_now.reg;
// Weird quirky unsigned things were happening when I tried to cast these directly to doubles below.
@@ -76,8 +76,8 @@ static void _sunrise_sunset_face_update(sunrise_sunset_state_t *state) {
double lon = (double)lon_centi / 100.0;
// sunriset returns the rise/set times as signed decimal hours in UTC.
// this can mean hours below 0 or above 31, which won't fit into a watch_date_time struct.
// to deal with this, we set aside the offset in hours, and add it back before converting it to a watch_date_time.
// this can mean hours below 0 or above 31, which won't fit into a watch_date_time_t struct.
// to deal with this, we set aside the offset in hours, and add it back before converting it to a watch_date_time_t.
double hours_from_utc = ((double)movement_get_current_timezone_offset()) / 3600.0;
// we loop twice because if it's after sunset today, we need to recalculate to display values for tomorrow.
@@ -338,7 +338,7 @@ bool sunrise_sunset_face_loop(movement_event_t event, void *context) {
// if entering low energy mode, start tick animation
if (event.event_type == EVENT_LOW_ENERGY_UPDATE && !watch_sleep_animation_is_running()) watch_start_sleep_animation(1000);
// check if we need to update the display
watch_date_time date_time = movement_get_local_date_time();
watch_date_time_t date_time = movement_get_local_date_time();
if (date_time.reg >= state->rise_set_expires.reg) {
// and on the off chance that this happened before EVENT_TIMEOUT snapped us back to rise/set 0, go back now
state->rise_index = 0;

View File

@@ -52,7 +52,7 @@ typedef struct {
uint8_t rise_index;
uint8_t active_digit;
bool location_changed;
watch_date_time rise_set_expires;
watch_date_time_t rise_set_expires;
sunrise_sunset_lat_lon_settings_t working_latitude;
sunrise_sunset_lat_lon_settings_t working_longitude;
uint8_t longLatToUse;

View File

@@ -47,7 +47,7 @@ void voltage_face_activate(void *context) {
bool voltage_face_loop(movement_event_t event, void *context) {
(void) context;
watch_date_time date_time;
watch_date_time_t date_time;
switch (event.event_type) {
case EVENT_ACTIVATE:
_voltage_face_update_display();

View File

@@ -35,7 +35,7 @@ const char set_time_face_titles[SET_TIME_FACE_NUM_SETTINGS][3] = {"HR", "M1", "S
static bool _quick_ticks_running;
static int32_t current_offset;
static void _handle_alarm_button(watch_date_time date_time, uint8_t current_page) {
static void _handle_alarm_button(watch_date_time_t date_time, uint8_t current_page) {
// handles short or long pressing of the alarm button
switch (current_page) {
@@ -90,7 +90,7 @@ void set_time_face_activate(void *context) {
bool set_time_face_loop(movement_event_t event, void *context) {
uint8_t current_page = *((uint8_t *)context);
watch_date_time date_time = movement_get_local_date_time();
watch_date_time_t date_time = movement_get_local_date_time();
switch (event.event_type) {
case EVENT_TICK: