增加进入深睡AT 3330/1 3330/head
authorxue <2144439972@qq.com>
Thu, 2 Apr 2026 10:32:02 +0000 (18:32 +0800)
committerxue <2144439972@qq.com>
Thu, 2 Apr 2026 10:32:02 +0000 (18:32 +0800)
code/sdk/zhihui/UI/producttest/include/testPresenterC.h
code/sdk/zhihui/UI/producttest/src/testPresenter.cpp
code/sdk/zhihui/utils/custom_utils.c
code/sdk/zhihui/utils/custom_utils.h
code/sdk/zhihui/utils/custom_utils_at_cmd.c

index ee39aa1..217a59f 100644 (file)
@@ -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
 }
index 8c4b3c4..d19b5ca 100644 (file)
@@ -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
 }
index a8b47d1..c2afb03 100644 (file)
@@ -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
index a1b0765..59c43d3 100644 (file)
@@ -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);
index 50f1f7e..c880d6c 100644 (file)
@@ -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" },