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 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
In my programming, I create some timers. but it exists a strange situation between 2 particular timers(maybe there are some connections). For details, a timer called A is running,
the A timer period is 1 second and it will get the Linux system time and show it in the screen. So it should updates per second. Then I start the timer B, B’s period is also 1s, timer B is to read some record files and to show 10 records. The strange things occured, if I resume the timer B, the timer A’s period seems changed to 5s, so the display updates per 5 seconds. If I stop the timer B, the timer A runs OK again. Actually, I create other timers and make sure each time there are 2 timers is running(A and other one). And only when timer A and B is runing , the timer A affected. It puzzles me a lot. Because the same timer design is runs well in LVGL V 6.0.2.
What MCU/Processor/Board and compiler are you using?
What LVGL version are you using?
v8.0.1
What do you want to achieve?
What have you tried so far?
Code to reproduce
Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.
The code block(s) should be formatted like:
/* this is timer A */
static void TimeRefresh1sTaskCallBack(lv_timer_t* timer)
{
/* get system alarm events */
GetAllEvents(&g_Event.HMIEvent);
RefreshHeadBarStatus();
g_Event.LastEventCnt = g_Event.HMIEvent.cnt;
/* 清除缓存 */
memset(s_MenuBarRuntime.YMDCache, 0, sizeof(s_MenuBarRuntime.YMDCache));
memset(s_MenuBarRuntime.DMSCache, 0, sizeof(s_MenuBarRuntime.DMSCache));
/* get time*/
time_t time_seconds = time(0);
localtime_r(&time_seconds, &nowTime);
snprintf(s_MenuBarRuntime.YMDCache, MAX_HMI_STRLEN, "%02d-%02d-%02d",
nowTime.tm_year + 1900, nowTime.tm_mon + 1, nowTime.tm_mday);
snprintf(s_MenuBarRuntime.DMSCache, MAX_HMI_STRLEN, "%02d:%02d:%02d",
nowTime.tm_hour, nowTime.tm_min, nowTime.tm_sec);
/*update the timer label, it should update per second*/
lv_label_set_text_static(s_MenuBarObj.YearMonthDay, s_MenuBarRuntime.YMDCache);
lv_label_set_text_static(s_MenuBarObj.HourMinSec, s_MenuBarRuntime.DMSCache);
lv_obj_align_to(s_MenuBarObj.YearMonthDay, lv_scr_act(),
LV_ALIGN_BOTTOM_LEFT, 10, 0);
lv_obj_align_to(s_MenuBarObj.HourMinSec, lv_scr_act(),
LV_ALIGN_BOTTOM_LEFT, 18, -20);
}
/* this is timer B */
static void soe_time_cb(lv_timer_t* timer)
{
if (!s_soeRun.soeReq)
{
uint32_t tmpNum = s_soeRun.soeNum;
GetSOETotal(&tmpNum);
/* record updates */
if (tmpNum != s_soeRun.soeNum)
{
s_soeRun.soeNum = tmpNum;
EnableSOERefreshTask();
return;
}
else
{
return;// at most time, the timer will execute here and return ,the code below will not execute
}
}
/* 如果是发了但是还未收到回复的话,则不需要再度更新SOE数目 */
GET_STATUS_T ret = GetSOE(&g_SOE);
/* 更新收到的话则刷新表格 */
if (GET_OK_UPDATED == ret)
{
/* 重新计算总页面数并发送SOE请求消息队列 */
UpdateSOETotPage();
/* 接收到SOE信息后再重置按钮,从而保持数据刷新和控件显示同步 */
RefreshSOEPageInfo();
ShowSOEPageCtrlBtn();
RefreshShowSOETbl();
s_soeRun.soeReq = false;
}
/* 未更新成功需要进行处理 */
else
{
s_soeRun.soeUpdateErrCnt++;
/* 如果10s都没有更新成功,结束本次更新,重新获取SOE的总数 */
if (s_soeRun.soeUpdateErrCnt > 10)
{
s_soeRun.soeUpdateErrCnt = 0;
s_soeRun.soeReq = false;
}
}
}
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.