mirror of
https://github.com/No-Chicken/Power-Pico.git
synced 2026-04-03 13:02:36 +08:00
更新开机动画
This commit is contained in:
@@ -127,7 +127,7 @@ void ui_StartPage_screen_init(void)
|
|||||||
lv_obj_set_style_bg_opa(ui_Button4, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
lv_obj_set_style_bg_opa(ui_Button4, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||||
|
|
||||||
_ui_StartPage_btn_animation();
|
_ui_StartPage_btn_animation();
|
||||||
_flush_timer = lv_timer_create(ui_startpage_timer_cb, 500, NULL);
|
// _flush_timer = lv_timer_create(ui_startpage_timer_cb, 500, NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,38 +92,32 @@ void ui_full_screen_refresh(lv_obj_t * screen) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////// Timer //////////////////////
|
/////////////////////// Timer //////////////////////
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main timer for Refreshing the screens
|
* 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;
|
// do nothing
|
||||||
static uint8_t count = 0;
|
}
|
||||||
static uint8_t backlight_level = 0; // 初始亮度为 0%
|
|
||||||
static uint8_t target_backlight_level = 0; // 目标亮度
|
|
||||||
|
|
||||||
if (first_time_in == 0) {
|
////////////////////////// Animation //////////////////////
|
||||||
// 获取目标亮度
|
|
||||||
target_backlight_level = ui_get_back_light_level();
|
void ui_start_animation_done() {
|
||||||
first_time_in = 1;
|
// 初始化页面并加载主要界面
|
||||||
|
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) {
|
||||||
if (backlight_level < target_backlight_level) {
|
ui_set_back_light_level(v);
|
||||||
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();
|
|
||||||
|
|
||||||
// 停止定时器,避免重复初始化
|
static void _ui_Start_animation(void) {
|
||||||
lv_timer_del(timer);
|
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 //////////////////////
|
/////////////////////// ui_initialize //////////////////////
|
||||||
@@ -137,10 +131,11 @@ void ui_init(void)
|
|||||||
// set system settings
|
// set system settings
|
||||||
ui_set_display_rotation(ui_get_display_rotation());
|
ui_set_display_rotation(ui_get_display_rotation());
|
||||||
|
|
||||||
// timer
|
// main timer (you can add someting to do in the timer_cb if needed)
|
||||||
lv_timer_t * ui_MainTimer = lv_timer_create(main_timer, 50, NULL);
|
lv_timer_t * ui_MainTimer = lv_timer_create(main_timer_cb, 1000, NULL);
|
||||||
|
|
||||||
// start up, just load one time only
|
// start up, just load one time only
|
||||||
ui_StartPage_screen_init();
|
ui_StartPage_screen_init();
|
||||||
lv_scr_load(ui_StartPage);
|
lv_scr_load(ui_StartPage);
|
||||||
|
_ui_Start_animation();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user