table控件需要显示7列数据,行数不确定。
只显示一行数据时,界面正常,按钮可起作用,table列可左右拖动。
显示多行数据时,比如除标题行外,数据行3行及以上时,按按钮来回切换该页面和其他页面,都正常,数据刷新也正常。但是左右拖动或上下拖动table列或行时,有很大几率界面卡死,但是table里的数据还能正常刷新。
请教,这是哪里的问题?
static void lvgl_thread_entry(void *parameter)
{
lv_init();
lv_port_disp_init();
lv_port_indev_init();
lv_user_gui_init();
/* handle the tasks of LVGL */
while(1)
{
#ifdef AIC_LVGL_TEST_DEMO
#include "candata.h"
rt_err_t ret = rt_sem_take(&canRefreshSem, 1);
if (ret == RT_EOK)
{
uint8_t rowNumber = 0;
for (uint8_t id = 0; id < 10; id++)
{
if (canData[id].enable == 0)
{
continue;
}
rowNumber++;
lv_table_set_row_cnt(tblCan, rowNumber + 1);
lv_table_set_cell_value_fmt(tblCan, rowNumber, 0, "%d", id);
// lv_table_set_cell_value_fmt(tblCan, rowNumber, 1, "%d", canData[id].timeStamp);
struct tm datetime;
time_t timestamp = (time_t)canData[id].timeStamp;
localtime_r(×tamp, &datetime);
lv_table_set_cell_value_fmt(tblCan, rowNumber, 1, "%d:%d:%d", datetime.tm_hour, datetime.tm_min, datetime.tm_sec);
lv_table_set_cell_value_fmt(tblCan, rowNumber, 2, "%d", canData[id].mp2Adc);
lv_table_set_cell_value_fmt(tblCan, rowNumber, 3, "%d", canData[id].mp5Adc);
lv_table_set_cell_value_fmt(tblCan, rowNumber, 4, "%d", canData[id].temp1Value);
lv_table_set_cell_value_fmt(tblCan, rowNumber, 5, "%d", canData[id].coValue);
lv_table_set_cell_value_fmt(tblCan, rowNumber, 6, "%d", canData[id].smokeValue);
}
}
#endif
}
}
最近编辑记录 Gentlepig (2024-08-28 14:19:06)
离线
打开了lvgl的帧率及cpu占用率显示功能,内存占用没显示出来,可能和用了malloc有关。
以下提到的界面卡死,只是lvgl界面卡死,不能按及拖动,但是lvgl还能刷新帧率及cpu占用率,rtt的其他线程也正常。
复制了官方table例程:
https://lvgl.100ask.net/8.2/widgets/core/table.html#
例程是2列7行,运行后大部分情况下正常,有很小概率出现界面卡死。
改成4列7行,界面卡死概率更大了。
行列互换,改成7列,然后添加若干行,很容易出现界面卡死。
不拖动,只按压table的表格项,有时候会出现画面跳动以下,感觉像是触控数据出了问题。
void test_ui_init(void)
{
static lv_style_t fontDefault;
lv_style_init(&fontDefault);
lv_style_set_text_font(&fontDefault, &lv_font_montserrat_30);
lv_obj_t * table = lv_table_create(lv_scr_act());
// lv_obj_add_style(table, &fontDefault, 0);
lv_obj_set_size(table, 700, 400);
lv_table_set_cell_value(table, 0, 0, "Name");
lv_table_set_cell_value(table, 1, 0, "Apple");
lv_table_set_cell_value(table, 2, 0, "Banana");
lv_table_set_cell_value(table, 3, 0, "Lemon");
lv_table_set_cell_value(table, 4, 0, "Grape");
lv_table_set_cell_value(table, 5, 0, "Melon");
lv_table_set_cell_value(table, 6, 0, "Peach");
lv_table_set_cell_value(table, 7, 0, "Nuts");
lv_table_set_cell_value(table, 0, 1, "Price");
lv_table_set_cell_value(table, 1, 1, "$7");
lv_table_set_cell_value(table, 2, 1, "$4");
lv_table_set_cell_value(table, 3, 1, "$6");
lv_table_set_cell_value(table, 4, 1, "$2");
lv_table_set_cell_value(table, 5, 1, "$5");
lv_table_set_cell_value(table, 6, 1, "$1");
lv_table_set_cell_value(table, 7, 1, "$9");
// lv_table_set_cell_value(table, 0, 2, "Name");
// lv_table_set_cell_value(table, 1, 2, "Apple");
// lv_table_set_cell_value(table, 2, 2, "Banana");
// lv_table_set_cell_value(table, 3, 2, "Lemon");
// lv_table_set_cell_value(table, 4, 2, "Grape");
// lv_table_set_cell_value(table, 5, 2, "Melon");
// lv_table_set_cell_value(table, 6, 2, "Peach");
// lv_table_set_cell_value(table, 7, 2, "Nuts");
//
// lv_table_set_cell_value(table, 0, 3, "Price");
// lv_table_set_cell_value(table, 1, 3, "$7");
// lv_table_set_cell_value(table, 2, 3, "$4");
// lv_table_set_cell_value(table, 3, 3, "$6");
// lv_table_set_cell_value(table, 4, 3, "$2");
// lv_table_set_cell_value(table, 5, 3, "$5");
// lv_table_set_cell_value(table, 6, 3, "$1");
// lv_table_set_cell_value(table, 7, 3, "$9");
// lv_obj_set_height(table, 200);
lv_obj_center(table);
lv_obj_add_event_cb(table, draw_part_event_cb, LV_EVENT_DRAW_PART_BEGIN, NULL);
}
打开了lvgl的日值功能,有时候会出现这种警告:
[Warn] (60.346, +10) indev_pointer_proc: X is 809 which is greater than hor. res (in lv_indev.c line #362)
[Warn] (60.356, +10) indev_pointer_proc: X is 809 which is greater than hor. res (in lv_indev.c line #362)
[Warn] (60.366, +10) indev_pointer_proc: X is 809 which is greater than hor. res (in lv_indev.c line #362)
[Warn] (60.376, +10) indev_pointer_proc: X is 809 which is greater than hor. res (in lv_indev.c line #362)
[Warn] (60.406, +30) indev_pointer_proc: X is 809 which is greater than hor. res (in lv_indev.c line #362)
[Warn] (60.416, +10) indev_pointer_proc: X is 809 which is greater than hor. res (in lv_indev.c line #362)
[Warn] (60.426, +10) indev_pointer_proc: X is 809 which is greater than hor. res (in lv_indev.c line #362)
而且,手已经抬起没有再按压,结果还是不停的出现这个警告,再按下屏幕才消失。
不过出现界面卡死时不一定会有这个警告,有这个警告不一定会界面卡死。
最近编辑记录 Gentlepig (2024-08-29 11:47:58)
离线
lvgl线程优先级是20,touch线程优先级是25,改成19后,问题貌似消失,测试时间还不够长,有待验证,也不清楚修改优先级后会不会有其他影响。
最近编辑记录 Gentlepig (2024-08-30 08:42:33)
离线