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

Watchface: Numerals #2047

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

Conversation

liamcharger
Copy link
Contributor

@liamcharger liamcharger commented Mar 30, 2024

This PR adds a Numeral watch face, with inspiration from Apple Watch's numeral watch face. An image is attached below.
InfiniSim_2024-03-31_045911

@liamcharger liamcharger changed the title Numeral watch face Watchface: Numerals Mar 30, 2024
Copy link

github-actions bot commented Mar 30, 2024

Build size and comparison to main:

Section Size Difference
text 374160B 1344B
data 948B 0B
bss 22536B 0B

@NeroBurner NeroBurner added the new watchface This thread is about a new watchface label Oct 1, 2024
Copy link
Member

@mark9064 mark9064 left a comment

Choose a reason for hiding this comment

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

Looks great from the screenshot! I'll give this a test run after any changes from feedback are in

@liamcharger liamcharger requested a review from mark9064 October 27, 2024 14:53
@mark9064
Copy link
Member

I'll test this on my PT shortly and review after

Copy link
Member

@mark9064 mark9064 left a comment

Choose a reason for hiding this comment

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

The font ranges at the moment are very large, and the watchface cannot load (too much memory)

With these changes it works and everything seems as expected 😄

@liamcharger
Copy link
Contributor Author

Gotcha, I'll make a commit when I have the chance!

@liamcharger liamcharger requested a review from mark9064 January 2, 2025 15:10
Copy link
Member

@mark9064 mark9064 left a comment

Choose a reason for hiding this comment

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

Sorry for the slow review! I'm very busy, and there are many PRs. I think this is almost there!

Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown;
uint8_t currentDay = 0;
Utility::DirtyValue<bool> notificationState {};
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime {};
Copy link
Member

Choose a reason for hiding this comment

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

Instead of storing all of the current day/hour/etc as variables, how about having two time points:

Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::minutes>> currentDateTime;
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> currentDate;

Then if the currentDateTime is updated, redraw hours and minutes / AM/PM. Then set currentDate to std::chrono::time_point_cast<std::chrono::days>(currentDateTime.Get());, and see if currentDate is updated. If so, then redraw the day, day of week etc

Make sure to remove the variables that are unused after this


dateDay = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(dateDay, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
lv_label_set_text(dateDay, "--");
Copy link
Member

Choose a reason for hiding this comment

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

If this is about to be set in Refresh(), is it possible to skip giving it a value here? Same goes for the day of week

lfs_file f = {};
if (filesystem.FileOpen(&f, "/fonts/rounded_large.bin", LFS_O_RDONLY) >= 0) {
filesystem.FileClose(&f);
font_large = lv_font_load("F:/fonts/rounded_large.bin");
Copy link
Member

Choose a reason for hiding this comment

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

These should be camelCase

labelTimeAMPM1 = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text_static(labelTimeAMPM1, "");
lv_obj_set_style_local_text_font(labelTimeAMPM1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_small);
lv_obj_set_style_local_text_color(labelTimeAMPM1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x999999));
Copy link
Member

Choose a reason for hiding this comment

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

Since this colour is being used a couple of times I think it would be best if were a static constexpr member of the class (i.e static constexpr lv_color_t AMPMColor = lv_color_hex(0x999999) or similar)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new watchface This thread is about a new watchface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants