Automatically centers the date number in the date windows of the watch's face

This commit is contained in:
anschrammh 2023-05-30 19:10:39 +02:00
parent bc37beb5c0
commit 5a62e05e0e

View File

@ -82,7 +82,7 @@ static void update_watch_hands_angles(WatchFace_t * const watchFace, uint8_t inc
watchFace->secondHand.handAngle = 60 * watchFace->dateTime.tm_sec;
//Don't forget to update the day date window
sprintf(watchFace->dateWindow.dateWindowText, "%s%d", watchFace->dateTime.tm_mday < 10 ? " " : "", watchFace->dateTime.tm_mday);
sprintf(watchFace->dateWindow.dateWindowText, "%d", watchFace->dateTime.tm_mday);
lv_label_set_text_static(watchFace->dateWindow.dateWindowWidget, watchFace->dateWindow.dateWindowText);
APP_LOG_DEBUG("Syncing time");
@ -372,7 +372,9 @@ void watch_face_create(WatchFace_t * const watchFace)
}
watchFace->dateWindow.dateWindowWidget = lv_label_create(watchFace->display);
lv_label_set_text_static(watchFace->dateWindow.dateWindowWidget, watchFace->dateWindow.dateWindowText);
lv_obj_set_pos(watchFace->dateWindow.dateWindowWidget, 182,111);
lv_obj_set_pos(watchFace->dateWindow.dateWindowWidget, 180,112);
lv_obj_set_width(watchFace->dateWindow.dateWindowWidget, 20);
lv_obj_set_style_text_align(watchFace->dateWindow.dateWindowWidget, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN);
if(watchFace->hourHand.handImg)
{