From 5e4a607da29c8f4122267289729b3cd11c44d344 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E5=AD=99=E6=98=A5=E9=98=B3?= Date: Thu, 16 Oct 2025 15:55:42 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E6=94=B9AT^PMRMVOTE=EF=BC=8C=E6=94=AF?= =?utf8?q?=E6=8C=81=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../wstp/at_service/app/app_at_process.c | 33 ++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/code/sdk/application/wstp/at_service/app/app_at_process.c b/code/sdk/application/wstp/at_service/app/app_at_process.c index e83952834..47bf61254 100644 --- a/code/sdk/application/wstp/at_service/app/app_at_process.c +++ b/code/sdk/application/wstp/at_service/app/app_at_process.c @@ -1759,17 +1759,34 @@ uint32_t mcu_pm_add_vote(uint8_t *para, uint32_t para_len) uint32_t mcu_pm_remove_vote(uint8_t *para, uint32_t para_len) { - unused(para); - unused(para_len); - - uint8_t cnt = pm_veto_get_id_cnt(PM_ID_DEBUG); + pm_id_t pm_id = PM_ID_DEBUG; // 默认使用 PM_ID_DEBUG + + // 如果提供了参数,解析数字 + if (para != NULL && para_len > 0) { + // 尝试将参数转换为数字 + pm_id = (pm_id_t)atoi((char*)para); + + // 检查范围是否有效 + if (pm_id < PM_ID_BSP || pm_id >= PM_ID_MAX) { + wstp_print("Invalid PM_ID: %d (valid range: 0-%d)\r\n", pm_id, PM_ID_MAX - 1); + return ERRCODE_FAIL; + } + } + + // 获取 PM_ID 名称 + const char* pm_id_name = get_pm_id_name(pm_id); + + // 获取当前投票计数 + uint8_t cnt = pm_veto_get_id_cnt(pm_id); + if (cnt > 0) { - wstp_print("MCU remove pm_id_debug vote\r\n"); - uapi_pm_remove_sleep_veto(PM_ID_DEBUG); + wstp_print("MCU remove %s (PM_ID=%d) vote, current count=%d\r\n", pm_id_name, pm_id, cnt); + uapi_pm_remove_sleep_veto(pm_id); + wstp_print("\r\nMCU SLEEP SUCCESS (removed %s vote)\r\n", pm_id_name); } else { - wstp_print("MCU has delete pm_id_debug vote\r\n"); + wstp_print("MCU has already deleted %s (PM_ID=%d) vote (count=0)\r\n", pm_id_name, pm_id); } - wstp_print("\r\nMCU SLEEP SUCCESS\r\n"); + uapi_tcxo_delay_ms(5); // delay 5ms for print debug infor with uart return ERRCODE_SUCC; } -- 2.17.1