Important: unclear posts may not receive useful answers.
Before posting
- Get familiar with Markdown to format and structure your post
- Be sure to update lvgl from the latest version from the
master
branch.- Be sure you have checked the FAQ and read the relevant part of the documentation.
- If applicable use the Simulator to eliminate hardware related issues.
Delete this section if you read and applied the mentioned points.
Description
What MCU/Processor/Board and compiler are you using?
What LVGL version are you using? 8
What do you want to achieve? Create and update/refresh a label text value from an input (RTC).
What have you tried so far? Adding code to ‘ui_Screen1.c’.
Code to reproduce
Hi, I have successfully managed to add a internal RTC time value to a simple text label, the problem is this value doesn’t seem to update how can I do this? Do I create some kind of event or do I need to refresh the label text value? Thanks
Here is current code ‘ui_Screen1.c’:-
extern RTC_HandleTypeDef hrtc;
RTC_TimeTypeDef sTime = {0};
RTC_DateTypeDef sDate = {0};void ui_Screen1_screen_init(void)
{
ui_Screen1 = lv_obj_create(NULL);
lv_obj_clear_flag( ui_Screen1, LV_OBJ_FLAG_SCROLLABLE ); /// Flagsui_Label1 = lv_label_create(ui_Screen1);
lv_obj_set_width( ui_Label1, LV_SIZE_CONTENT); /// 1
lv_obj_set_height( ui_Label1, LV_SIZE_CONTENT); /// 1
lv_obj_set_x( ui_Label1, -94 );
lv_obj_set_y( ui_Label1, -99 );
lv_obj_set_align( ui_Label1, LV_ALIGN_CENTER );HAL_RTC_GetTime(&hrtc, &sTime, RTC_FORMAT_BIN);
*lv_label_set_text_fmt(ui_Label1, “%02d:%02d:%02d”, sTime.Hours,sTime.Minutes,sTime.Seconds);
*}