From ee32de97d3e810961ea11a3111dabc934229ce13 Mon Sep 17 00:00:00 2001 From: xue <2144439972@qq.com> Date: Thu, 2 Apr 2026 18:32:02 +0800 Subject: [PATCH] =?utf8?q?=E5=A2=9E=E5=8A=A0=E8=BF=9B=E5=85=A5=E6=B7=B1?= =?utf8?q?=E7=9D=A1AT?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../UI/producttest/include/testPresenterC.h | 4 +- .../UI/producttest/src/testPresenter.cpp | 76 +++++++------------ code/sdk/zhihui/utils/custom_utils.c | 7 ++ code/sdk/zhihui/utils/custom_utils.h | 1 + code/sdk/zhihui/utils/custom_utils_at_cmd.c | 14 ++++ 5 files changed, 52 insertions(+), 50 deletions(-) diff --git a/code/sdk/zhihui/UI/producttest/include/testPresenterC.h b/code/sdk/zhihui/UI/producttest/include/testPresenterC.h index ee39aa1bc..217a59fb7 100644 --- a/code/sdk/zhihui/UI/producttest/include/testPresenterC.h +++ b/code/sdk/zhihui/UI/producttest/include/testPresenterC.h @@ -33,7 +33,9 @@ extern "C" void factorytest_set_gps_button_state(int on); void factorytest_trigger_leaklight_ui(void); void factorytest_set_bt_discovery_active(int active); - + /** 产测「深睡」按钮同款:关 Cywee ACC、BLE、4G、去 PM_TEST veto、灭屏 */ + void factorytest_deepsleep_enter(void); + #ifdef __cplusplus #if __cplusplus } diff --git a/code/sdk/zhihui/UI/producttest/src/testPresenter.cpp b/code/sdk/zhihui/UI/producttest/src/testPresenter.cpp index 8c4b3c462..d19b5ca23 100644 --- a/code/sdk/zhihui/UI/producttest/src/testPresenter.cpp +++ b/code/sdk/zhihui/UI/producttest/src/testPresenter.cpp @@ -78,6 +78,10 @@ namespace OHOS static testPresenter *g_pSystemPresenter = nullptr; static int16_t g_pendingJumpSubView = -1; // TEST_VIEW enum value, -1 means none + extern "C" { + void factorytest_deepsleep_enter(void); + } + testPresenter::testPresenter() { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testPresenter::testPresenter"); @@ -244,31 +248,7 @@ namespace OHOS } if(strcmp(view.GetViewId(),"deepsleep") == 0) { - //TODO: close bt and cat1 , then deepsleep - #ifdef SUPPORT_CYWEE_SERVICE - do_cywee_service_check_msg(CYWEE_SERVICE_CMD_STOP_ACC,NULL); - #endif - stop_custom_ble_service(); - LOS_Msleep(50); - uapi_set4GCapability(false); - LOS_Msleep(50); - - uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST); - if (cnt == 1) { - uapi_pm_remove_sleep_veto(PM_ID_P_TEST); - } else { - // WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE,"CAT1 SERVICE MCU has got pm_id_cat1 vote\r\n"); - } - - - // mcu_pm_lcd_off(NULL,NULL); - - const power_display_svr_api_t * display_api = power_display_svr_get_api(); - if (display_api) - { - display_api->turn_off_screen(); - } - + factorytest_deepsleep_enter(); return true; } @@ -399,30 +379,7 @@ namespace OHOS } if(strcmp(view.GetViewId(),"deep") == 0) { - #ifdef SUPPORT_CYWEE_SERVICE - do_cywee_service_check_msg(CYWEE_SERVICE_CMD_STOP_ACC,NULL); - #endif - stop_custom_ble_service(); - LOS_Msleep(50); - uapi_set4GCapability(false); - LOS_Msleep(50); - - uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST); - if (cnt == 1) { - uapi_pm_remove_sleep_veto(PM_ID_P_TEST); - } else { - // WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE,"CAT1 SERVICE MCU has got pm_id_cat1 vote\r\n"); - } - - - // mcu_pm_lcd_off(NULL,NULL); - - const power_display_svr_api_t * display_api = power_display_svr_get_api(); - if (display_api) - { - display_api->turn_off_screen(); - } - + factorytest_deepsleep_enter(); return true; } #ifdef SUPPORT_A5133_SERVICE @@ -724,6 +681,27 @@ extern "C" } } + void factorytest_deepsleep_enter(void) + { +#ifdef SUPPORT_CYWEE_SERVICE + do_cywee_service_check_msg(CYWEE_SERVICE_CMD_STOP_ACC, NULL); +#endif + stop_custom_ble_service(); + LOS_Msleep(50); + uapi_set4GCapability(false); + LOS_Msleep(50); + + uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST); + if (cnt == 1) { + uapi_pm_remove_sleep_veto(PM_ID_P_TEST); + } + + const power_display_svr_api_t *display_api = power_display_svr_get_api(); + if (display_api != nullptr) { + display_api->turn_off_screen(); + } + } + #ifdef __cplusplus #if __cplusplus } diff --git a/code/sdk/zhihui/utils/custom_utils.c b/code/sdk/zhihui/utils/custom_utils.c index a8b47d1b0..c2afb0330 100644 --- a/code/sdk/zhihui/utils/custom_utils.c +++ b/code/sdk/zhihui/utils/custom_utils.c @@ -3280,6 +3280,13 @@ void uapi_factorytest_set_bt_discovery_active(int active) #endif } +void uapi_factorytest_deepsleep_enter(void) +{ +#ifdef CUSTOM_ZHIHUI + factorytest_deepsleep_enter(); +#endif +} + void uapi_factorytest_hide_test_lcd_button(void) { #ifdef CUSTOM_ZHIHUI diff --git a/code/sdk/zhihui/utils/custom_utils.h b/code/sdk/zhihui/utils/custom_utils.h index a1b076589..59c43d379 100644 --- a/code/sdk/zhihui/utils/custom_utils.h +++ b/code/sdk/zhihui/utils/custom_utils.h @@ -382,6 +382,7 @@ void uapi_factorytest_jump_to_subview_id(int16_t target); void uapi_factorytest_set_gps_button_state(int on); void uapi_factorytest_trigger_leaklight_ui(void); void uapi_factorytest_set_bt_discovery_active(int active); +void uapi_factorytest_deepsleep_enter(void); void uapi_factorytest_hide_test_lcd_button(void); void uapi_factorytest_hide_test_tp_button(void); void uapi_efuse_test_write(uint8_t *data,uint32_t byte_number,uint8_t len); diff --git a/code/sdk/zhihui/utils/custom_utils_at_cmd.c b/code/sdk/zhihui/utils/custom_utils_at_cmd.c index 50f1f7e01..c880d6cea 100644 --- a/code/sdk/zhihui/utils/custom_utils_at_cmd.c +++ b/code/sdk/zhihui/utils/custom_utils_at_cmd.c @@ -1125,6 +1125,19 @@ static uint32_t custom_producttest_jump(uint8_t *para, uint32_t paraLen, char *s return ERRCODE_SUCC; } +/* 产测「深睡」:与界面 deepsleep/deep 按钮相同(关 ACC/BLE/4G、去 PM_TEST veto、灭屏) */ +static uint32_t custom_factory_deepsleep_enter(uint8_t *para, uint32_t paraLen, char *strCommonCmd) +{ + UNUSED(para); + UNUSED(paraLen); + UNUSED(strCommonCmd); + /* 先打印再执行:灭屏后串口仍应能打出下行,但先入队日志便于产线确认命令已收到 */ + wstp_print("+FACTORYDEEPSLEEP: enter, exec\r\n"); + uapi_factorytest_deepsleep_enter(); + wstp_print("+FACTORYDEEPSLEEP: enter, ok\r\n"); + return ERRCODE_SUCC; +} + #ifdef SUPPORT_GNSS /* AT^GPSVIEW - jump to GPS test subview (need AT^ENTERTESTVIEW first) */ static uint32_t custom_gps_view(uint8_t *para, uint32_t paraLen, char *strCommonCmd) @@ -2743,6 +2756,7 @@ static const at_cmd_table_t g_custom_utils_cmd[] = { { (char *)"AT^GETFWVER", custom_get_fw_version, (char *)"get firmware version (buildversion)" }, { (char *)"AT^ENTERTESTVIEW", custom_enter_producttest_view, (char *)"enter/exit producttest UI: AT^ENTERTESTVIEW[=1|0]" }, { (char *)"AT^TESTJUMP", custom_producttest_jump, (char *)"jump producttest subview: AT^TESTJUMP=TP|LCD|BRIGHT|CHARGE|MOTOR|KEY|BUTTON|LEAKLIGHT|GSENSOR|BT|SE|GPS|DEEPSLEEP" }, + { (char *)"AT^FACTORYDEEPSLEEPENTER", custom_factory_deepsleep_enter,(char *)"producttest deep sleep prep (same as UI): AT^FACTORYDEEPSLEEPENTER" }, #ifdef SUPPORT_GNSS { (char *)"AT^GPSVIEW", custom_gps_view, (char *)"enter gps test subview (need AT^ENTERTESTVIEW first)" }, { (char *)"AT^GPS", custom_gps_switch, (char *)"gps switch (sync UI button): AT^GPS=1/0" }, -- 2.17.1