Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension of World Clock2 Face. #265

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rieck
Copy link
Contributor

@rieck rieck commented Aug 20, 2023

Changes

  • Refactored the main code of event loop and display
  • Refresh now happens immediately on button event (snappy)
  • Daylight saving time can be toggled for each zone
  • Button configuration has been adapted

Updated Manual

This is an alternative world clock face that allows the user to cycle through a list of selected time zones. It extends the original implementation by Joey Castillo. The face has two modes running mode and settings mode.

Settings mode

When the clock face is activated for the first time, it enters settings mode. Here, the user can select the time zones they want to display. The face shows a summary of the current time zone:

  • The top of the face displays the first two letters of the time zone abbreviation, such as "PS" for Pacific Standard Time or "CE" for "Central European Time".

  • The upper-right corner shows the index number of the time zone. This helps avoid confusion when multiple time zones have the same two-letter abbreviation.

  • The main display shows the offset from UTC, with a "+" indicating a positive offset and a "-" indicating a negative offset. For example, the offset for Japanese Standard Time is displayed as "+9:00".

The user can navigate through the time zones and select them using the following buttons:

  • The alarm button moves forward to the next time zone, while the light button moves backward to the previous zone. This way, the user can cycle through all 41 supported time zones.

  • A long press on the alarm button selects the current time zone, and the signal indicator appears at the top left. Another long press of the alarm button deselects the time zone.

  • A long press on the light button enables daylight saving time (DST) for the current time zone, and the lap indicator appears. Another long press of the light button disables DST.

  • The mode button exits settings mode and returns to running mode, if a zone has been selected, otherwise it moves to the next face.

Running mode

In the running mode, the face shows the time of the currently selected time zone. The face includes the following components:

  • The top of the face displays the first two letters of the time zone abbreviation, such as "PS" for Pacific Standard Time or "CE" for Central European Time.

  • The upper-right corner shows the current day of the month, which helps indicate time zones that cross the international date line with respect to the local time.

  • The main display shows the time in the selected time zone in either 12-hour or 24-hour form. There is no timeout, allowing users to keep the chosen time zone displayed for as long as they wish.

The user can navigate through the selected time zones using the following buttons:

  • The alarm button moves to the next selected time zone, while the light button moves to the previous zone.

  • A long press on the alarm button enters settings mode and enables the user to re-configure the selected time zones. If no time zone is selected, the face automatically enters settings mode.

  • A long press on the light button activates the LED illumination of the watch.

- Refactored the main code of event loop and display
- Display refresh now happens immediately on event
- Daylight saving time can be toggled for each zone
- Button configuration has been adapted
Copy link
Collaborator

@matheusmoreira matheusmoreira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The watch face seems much improved. Factoring more functionality out into more well named functions would improve it even more but that can be done incrementally in the future. There are also code deduplication opportunities across all the clock faces which can and should be explored.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. There's some display logic from the simple clock face duplicated here, we should consider moving such logic to the watch utils.

@@ -119,4 +120,4 @@ void world_clock2_face_resign(movement_settings_t *settings, void *context);
NULL, \
})

#endif /* WORLD_CLOCK2_FACE_H_ */
#endif /* WORLD_CLOCK2_FACE_H_ */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a purpose behind adding these spaces?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been using GNU indent to clean the files (https://www.gnu.org/software/indent/). I guess it is the default behavior to indent comment blocks on preprocessor directives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants