WatchFaceAnalog: Simplify date update check
This commit is contained in:
parent
e55a76f740
commit
11ade64166
2 changed files with 5 additions and 15 deletions
|
@ -223,20 +223,12 @@ void WatchFaceAnalog::Refresh() {
|
|||
}
|
||||
|
||||
currentDateTime = dateTimeController.CurrentDateTime();
|
||||
|
||||
if (currentDateTime.IsUpdated()) {
|
||||
Pinetime::Controllers::DateTime::Months month = dateTimeController.Month();
|
||||
uint8_t day = dateTimeController.Day();
|
||||
Pinetime::Controllers::DateTime::Days dayOfWeek = dateTimeController.DayOfWeek();
|
||||
|
||||
UpdateClock();
|
||||
|
||||
if ((month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) {
|
||||
lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), day);
|
||||
|
||||
currentMonth = month;
|
||||
currentDayOfWeek = dayOfWeek;
|
||||
currentDay = day;
|
||||
currentDate = std::chrono::time_point_cast<days>(currentDateTime.Get());
|
||||
if (currentDate.IsUpdated()) {
|
||||
lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), dateTimeController.Day());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,15 +37,13 @@ namespace Pinetime {
|
|||
private:
|
||||
uint8_t sHour, sMinute, sSecond;
|
||||
|
||||
Pinetime::Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown;
|
||||
Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown;
|
||||
uint8_t currentDay = 0;
|
||||
|
||||
DirtyValue<uint8_t> batteryPercentRemaining {0};
|
||||
DirtyValue<bool> isCharging {};
|
||||
DirtyValue<bool> bleState {};
|
||||
DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime;
|
||||
DirtyValue<bool> notificationState {false};
|
||||
using days = std::chrono::duration<int32_t, std::ratio<86400>>; // TODO: days is standard in c++20
|
||||
DirtyValue<std::chrono::time_point<std::chrono::system_clock, days>> currentDate;
|
||||
|
||||
lv_obj_t* hour_body;
|
||||
lv_obj_t* hour_body_trace;
|
||||
|
|
Loading…
Reference in a new issue