Merge PR #470 - fixes world_clock2 face

The new DST changes caused problems in one specific face - world_clock2.
An incorrect variable was used due to a confusing name.
It has been revised to fix the problems that were caused.

Closes #475.

Reported-by: CarpeNoctem <cryptomax@pm.me>
Fixed-by: David Volovskiy <devolov@gmail.com>
Tested-by: CarpeNoctem <cryptomax@pm.me>
Tested-on-hardware-by: CarpeNoctem <cryptomax@pm.me>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/470
GitHub-Issue: https://github.com/joeycastillo/Sensor-Watch/issues/475
This commit is contained in:
Matheus Afonso Martins Moreira
2024-09-15 20:45:33 -03:00
4 changed files with 19 additions and 10 deletions

View File

@@ -184,8 +184,8 @@ static bool mode_display(movement_event_t event, movement_settings_t *settings,
/* Determine current time at time zone and store date/time */
date_time = watch_rtc_get_date_time();
timestamp = watch_utility_date_time_to_unix_time(date_time, state->tz * 60);
date_time = watch_utility_date_time_from_unix_time(timestamp, state->tz * 60);
timestamp = watch_utility_date_time_to_unix_time(date_time, state->tz * 60);
date_time = watch_utility_date_time_from_unix_time(timestamp, state->tz_curr * 60);
previous_date_time = state->previous_date_time;
state->previous_date_time = date_time.reg;
@@ -239,14 +239,16 @@ static bool mode_display(movement_event_t event, movement_settings_t *settings,
break;
case EVENT_ALARM_BUTTON_UP:
state->current_zone = find_selected_zone(state, FORWARD);
state->previous_date_time = REFRESH_TIME;
state->tz_curr = get_timezone_offset(state->current_zone, watch_rtc_get_date_time());
state->previous_date_time = REFRESH_TIME;
break;
case EVENT_LIGHT_BUTTON_DOWN:
/* Do nothing. */
break;
case EVENT_LIGHT_BUTTON_UP:
state->current_zone = find_selected_zone(state, BACKWARD);
state->previous_date_time = REFRESH_TIME;
state->tz_curr = get_timezone_offset(state->current_zone, watch_rtc_get_date_time());
state->previous_date_time = REFRESH_TIME;
break;
case EVENT_LIGHT_LONG_PRESS:
movement_illuminate_led();
@@ -290,7 +292,7 @@ static bool mode_settings(movement_event_t event, movement_settings_t *settings,
watch_clear_indicator(WATCH_INDICATOR_PM);
refresh_face = false;
}
result = div(state->tz, 60);
result = div(state->tz_curr, 60);
hours = result.quot;
minutes = result.rem;
@@ -319,17 +321,21 @@ static bool mode_settings(movement_event_t event, movement_settings_t *settings,
break;
case EVENT_ALARM_BUTTON_UP:
state->current_zone = mod(state->current_zone + FORWARD, NUM_TIME_ZONES);
state->tz_curr = get_timezone_offset(state->current_zone, watch_rtc_get_date_time());
break;
case EVENT_LIGHT_BUTTON_UP:
state->current_zone = mod(state->current_zone + BACKWARD, NUM_TIME_ZONES);
state->tz_curr = get_timezone_offset(state->current_zone, watch_rtc_get_date_time());
break;
case EVENT_LIGHT_BUTTON_DOWN:
/* Do nothing */
break;
case EVENT_ALARM_LONG_PRESS:
/* Find next selected zone */
if (!state->zones[state->current_zone].selected)
state->current_zone = find_selected_zone(state, FORWARD);
if (!state->zones[state->current_zone].selected) {
state->current_zone = find_selected_zone(state, FORWARD);
state->tz_curr = get_timezone_offset(state->current_zone, watch_rtc_get_date_time());
}
/* Switch to display mode */
state->current_mode = WORLD_CLOCK2_MODE_DISPLAY;