diff --git a/src/W800 SDK v1.00.08/app/gfx/watch_face.c b/src/W800 SDK v1.00.08/app/gfx/watch_face.c index fb25a5f..9ea0d41 100644 --- a/src/W800 SDK v1.00.08/app/gfx/watch_face.c +++ b/src/W800 SDK v1.00.08/app/gfx/watch_face.c @@ -2,6 +2,7 @@ #include "watch_face.h" #include "menu_screen.h" #include +#include "app_log.h" static void gesture_event_cb(lv_event_t * e) { @@ -60,6 +61,7 @@ static void update_watch_hands_angles(WatchFace_t * const watchFace, uint8_t inc //Don't forget to update the day date window sprintf(watchFace->dateWindow.dateWindowText, "%s%d", watchFace->dateTime.tm_mday < 10 ? " " : "", watchFace->dateTime.tm_mday); lv_obj_invalidate(watchFace->dateWindow.dateWindowWidget); + APP_LOG_DEBUG("Syncing time"); } else { @@ -133,6 +135,7 @@ void watch_face_create(WatchFace_t * const watchFace) watchFace->display = NULL; } watchFace->display = lv_obj_create(NULL); + lv_obj_set_style_bg_color(watchFace->display, lv_color_black(), LV_PART_MAIN); //We load our assets : lv_obj_t *watchFaceImg = lv_img_create(watchFace->display); lv_img_set_src(watchFaceImg, &watch_casio_face_asset); @@ -225,6 +228,19 @@ void watch_face_create(WatchFace_t * const watchFace) watchFace->handAnimationTimer = lv_timer_create(&(hand_timer_anim_cb), 199, watchFace); } +void watch_face_force_sync(WatchFace_t *const watchFace) +{ + if(!watchFace) + { + LV_LOG_ERROR("NULL pointer given !"); + return; + } + + if(!watchFace->display) return; + + update_watch_hands_angles(watchFace, 0); +} + void watch_face_destroy(WatchFace_t * const watchFace) { if(!watchFace) diff --git a/src/W800 SDK v1.00.08/app/gfx/watch_face.h b/src/W800 SDK v1.00.08/app/gfx/watch_face.h index 104c7fe..8e27147 100644 --- a/src/W800 SDK v1.00.08/app/gfx/watch_face.h +++ b/src/W800 SDK v1.00.08/app/gfx/watch_face.h @@ -42,6 +42,13 @@ void watch_face_register_cb(WatchFace_t * const watchFace, DateTimeCb_t DateTime /* Builds the watch face graphically */ void watch_face_create(WatchFace_t * const watchFace); +/** + * @brief Forces the watch face to sync up with the RTC by calling the provided date_time_cb + * + * @param watchFace a pointer to the watch face context structure. + */ +void watch_face_force_sync(WatchFace_t * const watchFace); + /* Frees all resources used by the WatchFace object */ void watch_face_destroy(WatchFace_t * const watchFace);