@@ -222,43 +222,36 @@ void WatchFaceCasioStyleG7710::Refresh() {
222222 lv_label_set_text_static (notificationIcon, NotificationIcon::GetIcon (notificationState.Get ()));
223223 }
224224
225- currentDateTime = dateTimeController.CurrentDateTime ();
226-
225+ currentDateTime = std::chrono::time_point_cast<std::chrono::minutes>(dateTimeController.CurrentDateTime ());
227226 if (currentDateTime.IsUpdated ()) {
228- auto hour = dateTimeController.Hours ();
229- auto minute = dateTimeController.Minutes ();
230- auto year = dateTimeController.Year ();
231- auto month = dateTimeController.Month ();
232- auto dayOfWeek = dateTimeController.DayOfWeek ();
233- auto day = dateTimeController.Day ();
234- auto dayOfYear = dateTimeController.DayOfYear ();
235-
236- auto weekNumberFormat = " %V" ;
237-
238- if (displayedHour != hour || displayedMinute != minute) {
239- displayedHour = hour;
240- displayedMinute = minute;
241-
242- if (settingsController.GetClockType () == Controllers::Settings::ClockType::H12) {
243- char ampmChar[2 ] = " A" ;
244- if (hour == 0 ) {
245- hour = 12 ;
246- } else if (hour == 12 ) {
247- ampmChar[0 ] = ' P' ;
248- } else if (hour > 12 ) {
249- hour = hour - 12 ;
250- ampmChar[0 ] = ' P' ;
251- }
252- lv_label_set_text (label_time_ampm, ampmChar);
253- lv_label_set_text_fmt (label_time, " %2d:%02d" , hour, minute);
254- lv_obj_align (label_time, lv_scr_act (), LV_ALIGN_CENTER, 0 , 40 );
255- } else {
256- lv_label_set_text_fmt (label_time, " %02d:%02d" , hour, minute);
257- lv_obj_align (label_time, lv_scr_act (), LV_ALIGN_CENTER, 0 , 40 );
227+ uint8_t hour = dateTimeController.Hours ();
228+ uint8_t minute = dateTimeController.Minutes ();
229+
230+ if (settingsController.GetClockType () == Controllers::Settings::ClockType::H12) {
231+ char ampmChar[2 ] = " A" ;
232+ if (hour == 0 ) {
233+ hour = 12 ;
234+ } else if (hour == 12 ) {
235+ ampmChar[0 ] = ' P' ;
236+ } else if (hour > 12 ) {
237+ hour = hour - 12 ;
238+ ampmChar[0 ] = ' P' ;
258239 }
240+ lv_label_set_text (label_time_ampm, ampmChar);
241+ lv_label_set_text_fmt (label_time, " %2d:%02d" , hour, minute);
242+ } else {
243+ lv_label_set_text_fmt (label_time, " %02d:%02d" , hour, minute);
259244 }
245+ lv_obj_realign (label_time);
260246
261- if ((year != currentYear) || (month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) {
247+ currentDate = std::chrono::time_point_cast<days>(currentDateTime.Get ());
248+ if (currentDate.IsUpdated ()) {
249+ const char * weekNumberFormat = " %V" ;
250+
251+ uint16_t year = dateTimeController.Year ();
252+ Controllers::DateTime::Months month = dateTimeController.Month ();
253+ uint8_t day = dateTimeController.Day ();
254+ int dayOfYear = dateTimeController.DayOfYear ();
262255 if (settingsController.GetClockType () == Controllers::Settings::ClockType::H24) {
263256 // 24h mode: ddmmyyyy, first DOW=Monday;
264257 lv_label_set_text_fmt (label_date, " %3d-%2d" , day, month);
@@ -293,11 +286,6 @@ void WatchFaceCasioStyleG7710::Refresh() {
293286 lv_obj_realign (label_day_of_year);
294287 lv_obj_realign (label_week_number);
295288 lv_obj_realign (label_date);
296-
297- currentYear = year;
298- currentMonth = month;
299- currentDayOfWeek = dayOfWeek;
300- currentDay = day;
301289 }
302290 }
303291
0 commit comments