更新开机动画

This commit is contained in:
不吃油炸鸡
2025-11-27 10:02:13 +08:00
parent 219af3079f
commit 5a62e430b8
2 changed files with 22 additions and 27 deletions

View File

@@ -92,38 +92,32 @@ void ui_full_screen_refresh(lv_obj_t * screen) {
}
/////////////////////// Timer //////////////////////
/**
* Main timer for Refreshing the screens
*/
static void main_timer(lv_timer_t * timer)
static void main_timer_cb(lv_timer_t * timer)
{
static uint8_t first_time_in = 0;
static uint8_t count = 0;
static uint8_t backlight_level = 0; // 初始亮度为 0%
static uint8_t target_backlight_level = 0; // 目标亮度
// do nothing
}
if (first_time_in == 0) {
// 获取目标亮度
target_backlight_level = ui_get_back_light_level();
first_time_in = 1;
////////////////////////// Animation //////////////////////
void ui_start_animation_done() {
// 初始化页面并加载主要界面
lv_lib_pm_Init();
for (uint8_t i = 0; i < sizeof(pages) / sizeof(pages[0]); i++) {
lv_lib_pm_register(&pages[i]);
}
lv_lib_pm_load_init_screen();
}
// 调整背光亮度
if (backlight_level < target_backlight_level) {
backlight_level++;
ui_set_back_light_level(backlight_level); // 设置当前亮度
} else {
// 初始化页面并加载主要界面
lv_lib_pm_Init();
for (uint8_t i = 0; i < sizeof(pages) / sizeof(pages[0]); i++) {
lv_lib_pm_register(&pages[i]);
}
lv_lib_pm_load_init_screen();
void ui_anima_set_light_level(void * var, int32_t v) {
ui_set_back_light_level(v);
}
// 停止定时器,避免重复初始化
lv_timer_del(timer);
}
static void _ui_Start_animation(void) {
uint8_t target_level = ui_get_back_light_level();
lv_lib_anim_user_animation(NULL, 0, 2000, 0, target_level, 0, 0, 0, 0, lv_anim_path_ease_in, ui_anima_set_light_level, ui_start_animation_done);
}
/////////////////////// ui_initialize //////////////////////
@@ -137,10 +131,11 @@ void ui_init(void)
// set system settings
ui_set_display_rotation(ui_get_display_rotation());
// timer
lv_timer_t * ui_MainTimer = lv_timer_create(main_timer, 50, NULL);
// main timer (you can add someting to do in the timer_cb if needed)
lv_timer_t * ui_MainTimer = lv_timer_create(main_timer_cb, 1000, NULL);
// start up, just load one time only
ui_StartPage_screen_init();
lv_scr_load(ui_StartPage);
_ui_Start_animation();
}