Added new function to the watch face api to force a RTC resync.
This commit is contained in:
parent
b088e585c5
commit
a165e8a243
@ -2,6 +2,7 @@
|
|||||||
#include "watch_face.h"
|
#include "watch_face.h"
|
||||||
#include "menu_screen.h"
|
#include "menu_screen.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "app_log.h"
|
||||||
|
|
||||||
static void gesture_event_cb(lv_event_t * e)
|
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
|
//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, "%s%d", watchFace->dateTime.tm_mday < 10 ? " " : "", watchFace->dateTime.tm_mday);
|
||||||
lv_obj_invalidate(watchFace->dateWindow.dateWindowWidget);
|
lv_obj_invalidate(watchFace->dateWindow.dateWindowWidget);
|
||||||
|
APP_LOG_DEBUG("Syncing time");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -133,6 +135,7 @@ void watch_face_create(WatchFace_t * const watchFace)
|
|||||||
watchFace->display = NULL;
|
watchFace->display = NULL;
|
||||||
}
|
}
|
||||||
watchFace->display = lv_obj_create(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 :
|
//We load our assets :
|
||||||
lv_obj_t *watchFaceImg = lv_img_create(watchFace->display);
|
lv_obj_t *watchFaceImg = lv_img_create(watchFace->display);
|
||||||
lv_img_set_src(watchFaceImg, &watch_casio_face_asset);
|
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);
|
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)
|
void watch_face_destroy(WatchFace_t * const watchFace)
|
||||||
{
|
{
|
||||||
if(!watchFace)
|
if(!watchFace)
|
||||||
|
@ -42,6 +42,13 @@ void watch_face_register_cb(WatchFace_t * const watchFace, DateTimeCb_t DateTime
|
|||||||
/* Builds the watch face graphically */
|
/* Builds the watch face graphically */
|
||||||
void watch_face_create(WatchFace_t * const watchFace);
|
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 */
|
/* Frees all resources used by the WatchFace object */
|
||||||
void watch_face_destroy(WatchFace_t * const watchFace);
|
void watch_face_destroy(WatchFace_t * const watchFace);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user