From 9e93dcebf906375c69599756bf6c191bc74db01f Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Thu, 19 Dec 2024 18:45:21 +0800 Subject: [PATCH] =?utf8?q?=E4=BC=91=E7=9C=A0=E6=97=A5=E5=BF=97=E4=BF=AE?= =?utf8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../brandy/brandy_standard/thread_init.c | 31 ++++++++++++++++--- .../peripheral/utils/custom_save_runtime.h | 5 ++- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/code/sdk/application/brandy/brandy_standard/thread_init.c b/code/sdk/application/brandy/brandy_standard/thread_init.c index f0d7f8bb3..618853b18 100755 --- a/code/sdk/application/brandy/brandy_standard/thread_init.c +++ b/code/sdk/application/brandy/brandy_standard/thread_init.c @@ -256,6 +256,10 @@ void thread_init(void) } } } +#if ENABLE_LOW_POWER == YES + static uint32_t last_sys_slp=0x0; + static bool last_m_core_sleep=false; +#endif static void print_system_sleep_info(void) { @@ -289,12 +293,29 @@ static void print_system_sleep_info(void) "App run time:%d, app deepsleep time:%d, lightsleep time:%d, m sleep flag:%d", (uint32_t)los_system_system_run_time(), deepsleep_time, lightsleep_time, (uint8_t)m_core_sleep); - if(m_core_sleep) - uapi_save_runtime_log(RUNTIME_LOG_lOW_POWER_M_SLEEP); - else - uapi_save_runtime_log(RUNTIME_LOG_lOW_POWER_MIN); + if(last_m_core_sleep!=m_core_sleep) + { + if(m_core_sleep) + uapi_save_runtime_log(RUNTIME_LOG_lOW_POWER_M_SLEEP); + else + uapi_save_runtime_log(RUNTIME_LOG_lOW_POWER_NO_M_SLEEP); + + last_m_core_sleep=m_core_sleep; + } + + if(last_sys_slp!=sys_slp) + { + if(sys_slp) + uapi_save_runtime_log(RUNTIME_LOG_lOW_POWER_SYS_SLEEP); + else + uapi_save_runtime_log(RUNTIME_LOG_lOW_POWER_NO_SYS_SLEEP); + + last_sys_slp=sys_slp; + } + + - uapi_save_runtime_log(RUNTIME_LOG_lOW_POWER_MIN|sleep_info->sleep_veto.last_veto_id); + // uapi_save_runtime_log(RUNTIME_LOG_lOW_POWER_MIN|sleep_info->sleep_veto.last_veto_id); #endif } diff --git a/code/sdk/drivers/peripheral/utils/custom_save_runtime.h b/code/sdk/drivers/peripheral/utils/custom_save_runtime.h index b0bdb91eb..b5537c374 100644 --- a/code/sdk/drivers/peripheral/utils/custom_save_runtime.h +++ b/code/sdk/drivers/peripheral/utils/custom_save_runtime.h @@ -190,7 +190,10 @@ typedef enum { //低功耗记录 RUNTIME_LOG_lOW_POWER_MIN = 0x1000, - RUNTIME_LOG_lOW_POWER_M_SLEEP=0x10ff, + RUNTIME_LOG_lOW_POWER_M_SLEEP, + RUNTIME_LOG_lOW_POWER_NO_M_SLEEP, + RUNTIME_LOG_lOW_POWER_SYS_SLEEP, + RUNTIME_LOG_lOW_POWER_NO_SYS_SLEEP, //录音 RUNTIME_LOG_RECORD_MIN = 0x1100, RUNTIME_LOG_RECORD_START, // 0x1101 录音开始 -- 2.17.1