From d5dd4001ecc8150da8500bee3707a69ff30e6986 Mon Sep 17 00:00:00 2001 From: caisking Date: Sat, 25 Apr 2026 18:22:04 +0800 Subject: [PATCH] =?utf8?q?=E4=BC=98=E5=8C=96=E5=BC=80=E6=9C=BA=E5=8A=A8?= =?utf8?q?=E7=94=BB=E6=97=B6=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../brandy/brandy_standard/thread_pri_init.c | 15 ++++++++------- .../wearable/ohos_startup/ohosfwk_startup.c | 12 +++++++++--- .../src/service/src/graphic_service_wrapper.cpp | 12 ++++++++++-- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/code/sdk/application/brandy/brandy_standard/thread_pri_init.c b/code/sdk/application/brandy/brandy_standard/thread_pri_init.c index 275be3dc5..bc234f7be 100644 --- a/code/sdk/application/brandy/brandy_standard/thread_pri_init.c +++ b/code/sdk/application/brandy/brandy_standard/thread_pri_init.c @@ -543,12 +543,18 @@ static void thread_main(const void *unused) //尽早显示启动logo ,需要 lcd 驱动,mount file system , power_display 线程管理 lcd背光 ohos_show_bootup_logo(); - button_app_init(); - #ifdef SUPPORT_AT_VIBRATOR uapi_vibrator_service_init(); #endif +#ifdef SUPPORT_OHOSFWK + // 提前启动开机动画和OHOS框架,避免被后续服务初始化延后 + ohos_startup(); +#endif + + button_app_init(); + + #ifdef CONFIG_SYSTEM_VIEW SEGGER_SYSVIEW_Conf(); // 请在抓取systemview开始的地方调用SEGGER_SYSVIEW_Start接口 @@ -626,11 +632,6 @@ static void thread_main(const void *unused) // uapi_gnss_http_server_init(); #endif -#ifdef SUPPORT_OHOSFWK - //开始播放开机动画,并启动ohos系统 - ohos_startup(); -#endif - #ifdef SUPPORT_PPG_SERVICE uapi_ppg_service_init(); #endif diff --git a/code/sdk/application/wearable/ohos_startup/ohosfwk_startup.c b/code/sdk/application/wearable/ohos_startup/ohosfwk_startup.c index 200138782..095dcca5f 100644 --- a/code/sdk/application/wearable/ohos_startup/ohosfwk_startup.c +++ b/code/sdk/application/wearable/ohos_startup/ohosfwk_startup.c @@ -29,6 +29,10 @@ #ifdef ENABLE_HP4570 #include "hp4570.h" #endif +#include "vibrator_service.h" + +#define POWER_ON_VOLTAGE_STABILIZE_MS 1000 +#define BOOT_FLOW_PREFIX "[BOOT_FLOW][开机流程] " // int32_t user_get_random_bytes(uint32_t size, uint8_t *randnum) // { @@ -64,7 +68,7 @@ static bool check_power_on_voltage(void) { float batV = 0.0f; disable_charge(); - uapi_tcxo_delay_ms(1000); + uapi_tcxo_delay_ms(POWER_ON_VOLTAGE_STABILIZE_MS); batteryservice_get_voltage_by_channel(&batV,ADC_CHANNEL_BAT_VOLTAGE); enable_charge(); @@ -220,10 +224,12 @@ void ohos_startup() //#ifdef BOARD_LEINIAO #ifdef ENABLE_UIKIT + PRINT(BOOT_FLOW_PREFIX "启动阶段:开机动画初始化开始\n"); boot_animation_init(); + wait_animation_stop(); + PRINT(BOOT_FLOW_PREFIX "启动阶段:开机动画播放结束\n"); + boot_animation_init_deinit(); #endif -wait_animation_stop(); -boot_animation_init_deinit(); //#endif #if defined(CONFIG_OTA_UPDATE_SUPPORT) && defined(ENABLE_UIKIT) //如果在升级状态,则不进入系统 diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service_wrapper.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service_wrapper.cpp index 742270b01..7c49150aa 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service_wrapper.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service_wrapper.cpp @@ -553,16 +553,24 @@ extern "C" OHOS::RootView::GetInstance()->Add(boot_group); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, BOOT_FLOW_PREFIX "开机动画任务:开机动画开始播放"); ReBootImageAnimatorView->Start(); - }, - false); + }); } void wait_animation_stop(void) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, BOOT_FLOW_PREFIX "开机动画等待:开始等待动画结束"); + uint32_t wait_seconds = 0; + static constexpr uint32_t BOOT_ANIM_WAIT_TIMEOUT_S = 15; while (boot_animation_flag == false) { LOS_Msleep(1000); + wait_seconds++; + if (wait_seconds >= BOOT_ANIM_WAIT_TIMEOUT_S) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, + BOOT_FLOW_PREFIX "开机动画等待:超过%u秒仍未结束,超时继续启动", + BOOT_ANIM_WAIT_TIMEOUT_S); + break; + } } WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, BOOT_FLOW_PREFIX "开机动画等待:动画已结束"); } -- 2.17.1