提交 9dbd4515 编写于 作者: jihaiyu's avatar jihaiyu 提交者: 叶康

tools:factory:修改字体,解决字体卡死问题

上级 5abf8f99
# SPDX-License-Identifier: Apache-2.0
DT_CHOSEN_Z_FLASH_RES_LV_FONT :=resource,lv_font
menu "Example Configuration"
config EXAMPLE_WIFI_SSID
......@@ -35,11 +35,3 @@ endif
rsource "Kconfig.capability"
source "Kconfig.zephyr"
config FLASH_RES_LV_FONT_CHINESE_ADDRESS
hex "algorithm resource data space start address"
default "$(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH_RES_LV_FONT))"
config FLASH_RES_LV_FONT_CHINESE_SIZE
hex "algorithm resource data space size"
default "$(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_FLASH_RES_LV_FONT))"
......@@ -18,7 +18,6 @@
zephyr,code-partition = &ap_code_partition;
resource,cp = &cp_code_partition;
resource,littlefs = &littlefs_partition;
resource,lv_font=&lv_font_chinese_partition;
resource,wakeup_cae_mlp = &wakeup_cae_mlp_partition;
resource,wakeup_esr_mlp = &wakeup_esr_mlp_partition;
resource,wakeup_esr_main = &wakeup_esr_main_partition;
......@@ -66,41 +65,38 @@
partitions {
ap_code_partition: partition@0 {
label = "ap_code";
reg = <0x00000 0x200000>;
reg = <0x00000 0x300000>;
};
cp_code_partition: partition@200000 {
cp_code_partition: partition@300000 {
label = "cp_code";
reg = <0x200000 0x100000>;
reg = <0x300000 0x100000>;
};
littlefs_partition: partition@300000 {
littlefs_partition: partition@400000 {
label = "littlefs_partition";
reg = < 0x300000 0x10000 >;
reg = < 0x400000 0x10000 >;
};
lv_font_chinese_partition: partition@310000 {
label = "lv_font_chinese";
reg = <0x310000 0x1c5d85>;
};
wakeup_cae_mlp_partition: partition@4f0000 {
wakeup_cae_mlp_partition: partition@410000 {
label = "wakeup_cae_mlp_partition";
reg = < 0x4f0000 1094112 >;
reg = < 0x410000 1094112 >;
};
wakeup_esr_mlp_partition: partition@600000 {
wakeup_esr_mlp_partition: partition@520000 {
label = "wakeup_esr_mlp_partition";
reg = < 0x600000 905728 >;
reg = < 0x520000 905728 >;
};
wakeup_esr_main_partition: partition@6f0000 {
wakeup_esr_main_partition: partition@600000 {
label = "wakeup_esr_main_partition";
reg = < 0x6f0000 208 >;
reg = < 0x600000 208 >;
};
wakeup_esr_cmds_partition: partition@6f1000 {
wakeup_esr_cmds_partition: partition@601000 {
label = "wakeup_esr_cmds_partition";
reg = < 0x6f1000 208 >;
reg = < 0x601000 208 >;
};
wakeup_ai_wrap_conf_partition: partition@6f2000 {
wakeup_ai_wrap_conf_partition: partition@602000 {
label = "wakeup_ai_wrap_conf_partition";
reg = < 0x6f2000 396 >;
reg = < 0x602000 396 >;
};
/* wifi driver private storage: 8Kb */
......
......@@ -28,12 +28,6 @@ app_generate_inc_file_for_target(
${gen_dir}/littlefs.inc
res_image_dependencies
)
app_generate_inc_file_for_target(
app
../resource/lv_font/lv_font_chinese_18.bin
${gen_dir}/lv_font_chinese_18.inc
res_image_dependencies
)
app_generate_inc_file_for_target(
......
......@@ -10,11 +10,6 @@ SECTION_PROLOGUE(RES_LITTLEFS,,)
KEEP(*(".littlefs.text"));
} GROUP_LINK_IN(RES_LITTLEFS)
SECTION_PROLOGUE(RES_LV_FONT,,)
{
KEEP(*(".lv_font_chinese_18.text"));
} GROUP_LINK_IN(RES_LV_FONT)
#if defined(CONFIG_CAPABILITY_WAKEUP)
......
......@@ -12,9 +12,6 @@ __attribute__((section(".littlefs.text"))) static const unsigned char littlefs[]
#include "littlefs.inc"
};
__attribute__((section(".lv_font_chinese_18.text"))) static const unsigned char lv_font_chinese_18[] = {
#include "lv_font_chinese_18.inc"
};
#if defined(CONFIG_CAPABILITY_WAKEUP)
......
......@@ -25,7 +25,6 @@ MEMORY
{
RES_VENUS_CP (r) : ORIGIN = (CONFIG_FLASH_BASE_ADDRESS + CONFIG_FLASH_RES_IMAGE_ADDRESS), LENGTH = CONFIG_FLASH_RES_IMAGE_SIZE
RES_LITTLEFS (r) : ORIGIN = (CONFIG_FLASH_BASE_ADDRESS + CONFIG_FLASH_RES_LITTLEFS_IMAGE_ADDRESS), LENGTH = CONFIG_FLASH_RES_LITTLEFS_IMAGE_SIZE
RES_LV_FONT (r) : ORIGIN = (CONFIG_FLASH_BASE_ADDRESS + CONFIG_FLASH_RES_LV_FONT_CHINESE_ADDRESS), LENGTH = CONFIG_FLASH_RES_LV_FONT_CHINESE_SIZE
#if defined(CONFIG_CAPABILITY_WAKEUP)
RES_WAKEUP_CAE_MLP (r) : ORIGIN = (CONFIG_FLASH_BASE_ADDRESS + CONFIG_FLASH_RES_WAKEUP_CAE_MLP_ADDRESS), LENGTH = CONFIG_FLASH_RES_WAKEUP_CAE_MLP_SIZE
RES_WAKEUP_ESR_MLP (r) : ORIGIN = (CONFIG_FLASH_BASE_ADDRESS + CONFIG_FLASH_RES_WAKEUP_ESR_MLP_ADDRESS), LENGTH = CONFIG_FLASH_RES_WAKEUP_ESR_MLP_SIZE
......
无法预览此类型文件
zephyr_include_directories(./)
zephyr_library_sources(
lv_font_chinese_18.c
lv_font_chinese_22.c
)
target_include_directories(app PRIVATE
......
#include "lvgl.h"
#include <zephyr/kernel.h>
#include <zephyr/devicetree.h>
typedef struct{
uint16_t min;
uint16_t max;
uint8_t bpp;
uint8_t reserved[3];
}x_header_t;
typedef struct{
uint32_t pos;
}x_table_t;
typedef struct{
uint8_t adv_w;
uint8_t box_w;
uint8_t box_h;
int8_t ofs_x;
int8_t ofs_y;
uint8_t r;
}glyph_dsc_t;
static x_header_t __g_xbf_hd = {
.min = 0x0009,
.max = 0xffe5,
.bpp = 4,
};
static uint8_t *__user_font_getdata(int offset, int size){
uint32_t font_address = CONFIG_FLASH_BASE_ADDRESS + CONFIG_FLASH_RES_LV_FONT_CHINESE_ADDRESS + offset;
return (uint8_t*)font_address;
}
static const uint8_t * __user_font_get_bitmap(const lv_font_t * font, uint32_t unicode_letter) {
if( unicode_letter>__g_xbf_hd.max || unicode_letter<__g_xbf_hd.min ) {
return NULL;
}
uint32_t unicode_offset = sizeof(x_header_t)+(unicode_letter-__g_xbf_hd.min)*4;
uint32_t *p_pos = (uint32_t *)__user_font_getdata(unicode_offset, 4);
if( p_pos[0] != 0 ) {
uint32_t pos = p_pos[0];
glyph_dsc_t * gdsc = (glyph_dsc_t*)__user_font_getdata(pos, sizeof(glyph_dsc_t));
return __user_font_getdata(pos+sizeof(glyph_dsc_t), gdsc->box_w*gdsc->box_h*__g_xbf_hd.bpp/8);
}
return NULL;
}
static bool __user_font_get_glyph_dsc(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter, uint32_t unicode_letter_next) {
if( unicode_letter>__g_xbf_hd.max || unicode_letter<__g_xbf_hd.min ) {
return NULL;
}
uint32_t unicode_offset = sizeof(x_header_t)+(unicode_letter-__g_xbf_hd.min)*4;
uint32_t *p_pos = (uint32_t *)__user_font_getdata(unicode_offset, 4);
if( p_pos[0] != 0 ) {
glyph_dsc_t * gdsc = (glyph_dsc_t*)__user_font_getdata(p_pos[0], sizeof(glyph_dsc_t));
dsc_out->adv_w = gdsc->adv_w;
dsc_out->box_h = gdsc->box_h;
dsc_out->box_w = gdsc->box_w;
dsc_out->ofs_x = gdsc->ofs_x;
dsc_out->ofs_y = gdsc->ofs_y;
dsc_out->bpp = __g_xbf_hd.bpp;
return true;
}
return false;
}
lv_font_t lv_font_chinese_18 = {
.get_glyph_bitmap = __user_font_get_bitmap,
.get_glyph_dsc = __user_font_get_glyph_dsc,
.line_height = 32,
.base_line = 0,
};
因为 它太大了无法显示 source diff 。您可以改为 查看blob
......@@ -52,7 +52,7 @@ ui_dvp_t *ui_dvp_get_ui_status(void)
}
static ui_dvp_btn_click_listener m_btn_click_listener;
LV_FONT_DECLARE(lv_font_chinese_18);
LV_FONT_DECLARE(lv_font_chinese_22);
static lv_obj_t *test_img = NULL;
static lv_obj_t *lv_dvp_test = NULL;
......@@ -118,7 +118,7 @@ static void ui_dvp_test_init(void *root_view, void *arg)
lv_label_set_text(ui_dvp_title_label, "请确认摄像头是否正常");
lv_obj_set_style_text_color(ui_dvp_title_label, lv_color_hex(0x00ff00), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_opa(ui_dvp_title_label, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(ui_dvp_title_label, &lv_font_chinese_18, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(ui_dvp_title_label, &lv_font_chinese_22, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui_dvp_title_label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);
lv_dvp_ok_btn = lv_btn_create(lv_dvp_test);
......@@ -132,7 +132,7 @@ static void ui_dvp_test_init(void *root_view, void *arg)
lv_obj_t *lv_dvp_ok_txt = lv_label_create(lv_dvp_ok_btn);
lv_label_set_text(lv_dvp_ok_txt, "是");
lv_obj_set_style_text_font(lv_dvp_ok_txt, &lv_font_chinese_18, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(lv_dvp_ok_txt, &lv_font_chinese_22, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_color(lv_dvp_ok_txt, lv_color_hex(0x0000ff), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_center(lv_dvp_ok_txt);
......@@ -149,7 +149,7 @@ static void ui_dvp_test_init(void *root_view, void *arg)
lv_obj_t *lv_dvp_err_txt = lv_label_create(lv_dvp_err_btn);
lv_label_set_text(lv_dvp_err_txt, "否");
lv_obj_set_style_text_font(lv_dvp_err_txt, &lv_font_chinese_18, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(lv_dvp_err_txt, &lv_font_chinese_22, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_color(lv_dvp_err_txt, lv_color_hex(0x0000ff), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_center(lv_dvp_err_txt);
lv_obj_add_event_cb(lv_dvp_err_btn, dvp_ui_event, LV_EVENT_PRESSED, NULL);
......@@ -160,7 +160,7 @@ static void ui_dvp_test_init(void *root_view, void *arg)
lv_label_set_text(lv_dvp_faild_txt, fail_lab);
lv_obj_set_style_text_color(lv_dvp_faild_txt, lv_color_hex(0xff0000), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_opa(lv_dvp_faild_txt, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(lv_dvp_faild_txt, &lv_font_chinese_18, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(lv_dvp_faild_txt, &lv_font_chinese_22, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(lv_dvp_faild_txt, lv_color_hex(0xffffff), LV_STATE_DEFAULT);
lv_obj_add_flag(lv_dvp_faild_txt, LV_OBJ_FLAG_HIDDEN);
}
......
......@@ -32,7 +32,7 @@ static ui_key_btn_click_listener m_btn_click_listener;
#define ROWS 2
#define COLS 2
static lv_obj_t *block[COLS * ROWS];
LV_FONT_DECLARE(lv_font_chinese_18);
LV_FONT_DECLARE(lv_font_chinese_22);
static lv_obj_t *lv_key_test = NULL;
static lv_obj_t *lv_key_ok_btn = NULL;
static lv_obj_t *lv_key_err_btn = NULL;
......@@ -135,7 +135,7 @@ static void ui_key_test_init(void *root_view,void* null)
lv_label_set_text(ui_demo_title_label, "按下k1,k2,boot,k3按键点亮方块");
lv_obj_set_style_text_color(ui_demo_title_label, lv_color_hex(0xffffff), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_opa(ui_demo_title_label, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(ui_demo_title_label, &lv_font_chinese_18, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(ui_demo_title_label, &lv_font_chinese_22, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui_demo_title_label, lv_color_hex(0x000000), LV_STATE_DEFAULT);
ui_key_title_label = lv_label_create(lv_key_test);
......@@ -144,7 +144,7 @@ static void ui_key_test_init(void *root_view,void* null)
lv_label_set_text(ui_key_title_label, "请确认屏幕是否正常显示");
lv_obj_set_style_text_color(ui_key_title_label, lv_color_hex(0x00ff00), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_opa(ui_key_title_label, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(ui_key_title_label, &lv_font_chinese_18, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(ui_key_title_label, &lv_font_chinese_22, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui_key_title_label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);
lv_obj_add_flag(ui_key_title_label, LV_OBJ_FLAG_HIDDEN); // 隐藏对象
......@@ -160,7 +160,7 @@ static void ui_key_test_init(void *root_view,void* null)
lv_obj_t *lv_key_ok_txt = lv_label_create(lv_key_ok_btn);
lv_label_set_text(lv_key_ok_txt, "是");
lv_obj_set_style_text_font(lv_key_ok_txt, &lv_font_chinese_18, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(lv_key_ok_txt, &lv_font_chinese_22, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_color(lv_key_ok_txt, lv_color_hex(0x0000ff), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_center(lv_key_ok_txt);
......@@ -178,7 +178,7 @@ static void ui_key_test_init(void *root_view,void* null)
lv_obj_t *lv_key_err_txt = lv_label_create(lv_key_err_btn);
lv_label_set_text(lv_key_err_txt, "否");
lv_obj_set_style_text_font(lv_key_err_txt, &lv_font_chinese_18, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(lv_key_err_txt, &lv_font_chinese_22, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_color(lv_key_err_txt, lv_color_hex(0xff0000), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_center(lv_key_err_txt);
lv_obj_add_event_cb(lv_key_err_btn, key_ui_event, LV_EVENT_PRESSED, NULL);
......@@ -188,7 +188,7 @@ static void ui_key_test_init(void *root_view,void* null)
lv_label_set_text(ui_key_err_label, fail_lab);
lv_obj_set_style_text_color(ui_key_err_label, lv_color_hex(0x00ff00), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_opa(ui_key_err_label, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(ui_key_err_label, &lv_font_chinese_18, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(ui_key_err_label, &lv_font_chinese_22, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui_key_err_label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);
lv_obj_add_flag(ui_key_err_label, LV_OBJ_FLAG_HIDDEN); // 隐藏对象
}
......
......@@ -113,7 +113,7 @@ int ui_lcd_get_rlt(void){
return test_is_ok;
}
static lv_obj_t *lv_lvgl_test = NULL;
LV_FONT_DECLARE(lv_font_chinese_18);
LV_FONT_DECLARE(lv_font_chinese_22);
static void ui_lvgl_test_init(void *root_view,void *arg)
{
lv_obj_t *lv_root_view = (lv_obj_t *)root_view;
......@@ -135,7 +135,7 @@ static void ui_lvgl_test_init(void *root_view,void *arg)
lv_label_set_text(ui_demo_title_label, "请滑动屏幕使方块消失");
lv_obj_set_style_text_color(ui_demo_title_label, lv_color_hex(0xff0000), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_opa(ui_demo_title_label, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(ui_demo_title_label, &lv_font_chinese_18, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(ui_demo_title_label, &lv_font_chinese_22, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui_demo_title_label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);
}
......
......@@ -16,7 +16,7 @@ LOG_MODULE_DECLARE(factory_test);
#define LV_COLOR_WHITE lv_color_hex(0x000000)
LV_FONT_DECLARE( lv_font_chinese_18);
LV_FONT_DECLARE( lv_font_chinese_22);
static ui_common_config_t *m_ui_config = NULL;
static lv_obj_t *lv_root_view = NULL;
......@@ -67,7 +67,7 @@ static void create_btn(lv_obj_t *root, const char *text, lv_align_t align)
lv_obj_t *btn_label = lv_label_create(btn); // 创建按钮的标签
lv_label_set_text(btn_label, text); // 设置按钮的标签文本
lv_obj_set_style_text_font(btn_label, &lv_font_chinese_18, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(btn_label, &lv_font_chinese_22, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_center(btn_label);
lv_obj_add_style(btn_label, &style_white_text, 0);
......@@ -79,7 +79,7 @@ static void create_label(lv_obj_t *root, const char *tip_label_text)
// 创建按钮标签
lv_obj_t *label = lv_label_create(root);
lv_label_set_text(label, tip_label_text);
lv_obj_set_style_text_font(label, &lv_font_chinese_18, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(label, &lv_font_chinese_22, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_align(label, LV_ALIGN_BOTTOM_RIGHT, 0, 0);
lv_obj_add_style(label, &style_white_text, 0);
}
......@@ -104,7 +104,7 @@ static void create_root_view(void)
lv_obj_clear_flag(lv_root_view, LV_OBJ_FLAG_SCROLLABLE); /// Flags
lv_obj_set_style_bg_color(lv_root_view, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(lv_root_view, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(lv_root_view, &lv_font_chinese_18, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(lv_root_view, &lv_font_chinese_22, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_scr_load(lv_root_view);
}
......
支持 Markdown
0% or
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册