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

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