D21x luban SDK LVGL UI示例配置 思源矢量汉字库后,在首页和2页来回滑动切换时界面卡死
是怎么回事??
最近编辑记录 80802680 (2024-06-25 00:53:52)
离线
请发一下你的字库,还有代码的改动点,我们这边测试一下。
1. make menuconfig,进入 menuconfig
ArtInChip Luban SDK Configuration --->
Third-party packages --->
freetype --->选择但取消二进制预编译
2.在lv_conf.h头文件中打开宏定义
#define LV_USE_FREETYPE 1
#define LV_BUILD_EXAMPLES 1
3.修改main.c中的入口函数:
/*Create a Demo*/
void base_ui_init();
base_ui_init();
4.复制TTF字体到lvgl-ui/base_ui/asserts/font目录下
5. 修改lvgl-ui\base_ui\base_ui.c
void base_ui_init()
{
FAKE_IMAGE_INIT(bg_dark, 1024, 600, 0, 0x00000000);
img_bg = lv_img_create(lv_scr_act());
lv_img_set_src(img_bg, LVGL_PATH(global_bg.png));
lv_obj_set_pos(img_bg, 0, 0);
/*Create a font*/
static lv_ft_info_t info;
/*FreeType uses C standard file system, so no driver letter is required.*/
info.name = "/usr/local/share/lvgl_data/font/GenJyuuGothic-Light-2.ttf";
info.weight = 48;
info.style = FT_FONT_STYLE_NORMAL;
info.mem = NULL;
if(!lv_ft_font_init(&info)) {
LV_LOG_ERROR("create failed.");
}
/*Create style*/
static lv_style_t font_style;
lv_style_init(&font_style);
lv_style_set_text_font(&font_style, info.font);
main_title = lv_label_create(img_bg);
lv_obj_set_width(main_title, LV_SIZE_CONTENT);
lv_obj_set_height(main_title, LV_SIZE_CONTENT);
lv_obj_align(main_title, LV_ALIGN_TOP_MID, 0, 0);
lv_obj_set_pos(main_title, 0, 10);
lv_obj_add_style( main_title, &font_style, 0 );
lv_label_set_text(main_title, "Meter");
lv_obj_set_style_text_color(main_title, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_opa(main_title, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
bg_fps = lv_label_create(img_bg);
lv_obj_set_width(bg_fps, LV_SIZE_CONTENT);
lv_obj_set_height(bg_fps, LV_SIZE_CONTENT);
lv_obj_align(bg_fps, LV_ALIGN_TOP_RIGHT, 0, 0);
lv_obj_set_pos(bg_fps, -130, 50);
lv_label_set_text(bg_fps, "");
lv_obj_set_style_text_color(bg_fps, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_opa(bg_fps, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(bg_fps, &ui_font_Title, LV_PART_MAIN | LV_STATE_DEFAULT);
bg_logo = lv_label_create(img_bg);
lv_obj_set_width(bg_logo, LV_SIZE_CONTENT);
lv_obj_set_height(bg_logo, LV_SIZE_CONTENT);
lv_obj_align(bg_logo, LV_ALIGN_BOTTOM_RIGHT, 0, 0);
lv_obj_set_pos(bg_logo, -30, -30);
lv_obj_add_style( bg_logo, &font_style, 0 );
lv_label_set_text(bg_logo, "矢量字");
lv_obj_set_style_text_color(bg_logo, lv_color_hex(0x00FFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_opa(bg_logo, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
其它的都不变
最近编辑记录 80802680 (2024-06-25 22:03:47)
离线
@80802680
LPKG_LVGL_THREAD_STACK_SIZE 这里的stack加大一点试试。
我测试的时候也出现卡死问题,修改了stack
LPKG_LVGL_THREAD_STACK_SIZE?
找遍了都没找到这个名称
离线
乘风 说:@80802680
我们这边用你的字体测试,没有发现卡死现象,请问你如果直接用base_demo的原始字体,是否会出现这种情况。make freetype-distclean 一下,然后再重新编译一下,试试这个是否可以解决
哦,刚用更新了SDK包,用最新的SDK包,编译后运行正常了,
以前没有更新,用的是1月左右的SDK包有这个BUG。
离线