diff --git a/movement/watch_faces/clock/world_clock2_face.c b/movement/watch_faces/clock/world_clock2_face.c index 5b3f8a9f3..19cf619be 100644 --- a/movement/watch_faces/clock/world_clock2_face.c +++ b/movement/watch_faces/clock/world_clock2_face.c @@ -277,7 +277,8 @@ static bool mode_settings(movement_event_t event, movement_settings_t *settings, int8_t hours, minutes; uint8_t zone; div_t result; - + int16_t tz_offset; + switch (event.event_type) { case EVENT_ACTIVATE: case EVENT_TICK: @@ -289,7 +290,13 @@ static bool mode_settings(movement_event_t event, movement_settings_t *settings, watch_clear_indicator(WATCH_INDICATOR_PM); refresh_face = false; } - result = div(movement_timezone_offsets[state->current_zone], 60); + + tz_offset = movement_timezone_offsets[state->current_zone]; + if (state->zones[state->current_zone].daylight_saving) { + tz_offset += 60; + } + + result = div(tz_offset, 60); hours = result.quot; minutes = result.rem; @@ -314,6 +321,11 @@ static bool mode_settings(movement_event_t event, movement_settings_t *settings, else watch_clear_indicator(WATCH_INDICATOR_SIGNAL); + if (state->zones[state->current_zone].daylight_saving) + watch_set_indicator(WATCH_INDICATOR_LAP); + else + watch_clear_indicator(WATCH_INDICATOR_LAP); + watch_display_string(buf, 0); break; case EVENT_ALARM_BUTTON_UP: @@ -326,6 +338,11 @@ static bool mode_settings(movement_event_t event, movement_settings_t *settings, /* Do nothing */ break; case EVENT_ALARM_LONG_PRESS: + /* Toggle daylight saving of current zone */ + zone = state->current_zone; + state->zones[zone].daylight_saving = !state->zones[zone].daylight_saving; + break; + case EVENT_MODE_BUTTON_UP: /* Find next selected zone */ if (!state->zones[state->current_zone].selected) state->current_zone = find_selected_zone(state, FORWARD); @@ -351,11 +368,6 @@ static bool mode_settings(movement_event_t event, movement_settings_t *settings, } } break; - case EVENT_MODE_BUTTON_UP: - /* Reset frequency and move to next face */ - movement_request_tick_frequency(1); - movement_move_to_next_face(); - break; default: return movement_default_loop_handler(event, settings); } diff --git a/movement/watch_faces/clock/world_clock2_face.h b/movement/watch_faces/clock/world_clock2_face.h index 0baac2123..e81f8e3bf 100644 --- a/movement/watch_faces/clock/world_clock2_face.h +++ b/movement/watch_faces/clock/world_clock2_face.h @@ -57,7 +57,10 @@ * * A long press on the LIGHT button selects the current time zone, and * the signal indicator appears at the top left. Another long press of * the LIGHT button deselects the time zone. - * * A long press on the ALARM button exits settings mode and returns to + * * A long press on the ALARM button toggles daylight saving for the + * current time zone, and the lap indicator appears at the top right. + * Another long press of the ALARM button toggles daylight saving off. + * * A press on the MODE button exits settings mode and returns to * display mode. * * Display mode @@ -97,6 +100,7 @@ typedef enum { typedef struct { bool selected; + bool daylight_saving; } world_clock2_zone_t; typedef struct {