Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions movement/watch_faces/clock/world_clock2_face.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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;

Expand All @@ -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:
Expand All @@ -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);
Expand All @@ -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);
}
Expand Down
6 changes: 5 additions & 1 deletion movement/watch_faces/clock/world_clock2_face.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -97,6 +100,7 @@ typedef enum {

typedef struct {
bool selected;
bool daylight_saving;
} world_clock2_zone_t;

typedef struct {
Expand Down