From 0e6828634feb134563a72de17ff382223c867ace Mon Sep 17 00:00:00 2001 From: anschrammh Date: Thu, 15 Jun 2023 23:06:03 +0200 Subject: [PATCH] Updated lvgl simulator watch face source file --- .../lv_port_win_codeblocks/LittlevGL.layout | 744 +++++++++--------- .../lv_port_win_codeblocks/watch_face.c | 13 +- 2 files changed, 382 insertions(+), 375 deletions(-) diff --git a/src/lvgl_win_sim/lv_port_win_codeblocks/LittlevGL.layout b/src/lvgl_win_sim/lv_port_win_codeblocks/LittlevGL.layout index 173d4d6..c390201 100644 --- a/src/lvgl_win_sim/lv_port_win_codeblocks/LittlevGL.layout +++ b/src/lvgl_win_sim/lv_port_win_codeblocks/LittlevGL.layout @@ -2,19 +2,19 @@ - + - + - + - + - + - + @@ -22,19 +22,14 @@ - + - + - + - - - - - - + @@ -42,84 +37,39 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -127,9 +77,14 @@ - + - + + + + + + @@ -142,99 +97,39 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -242,11 +137,236 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -256,24 +376,9 @@ - + - - - - - - - - - - - - - - - - + @@ -281,216 +386,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -516,4 +416,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/lvgl_win_sim/lv_port_win_codeblocks/watch_face.c b/src/lvgl_win_sim/lv_port_win_codeblocks/watch_face.c index efb846a..0d65b0b 100644 --- a/src/lvgl_win_sim/lv_port_win_codeblocks/watch_face.c +++ b/src/lvgl_win_sim/lv_port_win_codeblocks/watch_face.c @@ -64,6 +64,8 @@ static void cleanup_event_cb(lv_event_t * e) static void update_watch_hands_angles(WatchFace_t * const watchFace, uint8_t increment) { + + static uint8_t dateNum = 1; if(!watchFace) { LV_LOG_ERROR("NULL pointer given !"); @@ -74,13 +76,16 @@ static void update_watch_hands_angles(WatchFace_t * const watchFace, uint8_t inc if(watchFace->dateTimeCb) { //We compute each hand angle - if(!increment || watchFace->secondHand.handAngle >= 3660) + if(!increment || watchFace->secondHand.handAngle >= 3660 || (int)watchFace->secondHand.handAngle % 100 > 50) { watchFace->dateTimeCb(&watchFace->dateTime); watchFace->secondHand.handAngle = 60 * watchFace->dateTime.tm_sec; + dateNum++; + dateNum %= 31; + //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*/ dateNum); lv_label_set_text_static(watchFace->dateWindow.dateWindowWidget, watchFace->dateWindow.dateWindowText); if(watchFace->batteryIndicatorCb) @@ -368,7 +373,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) {