优化4G开关 1933/4
authorpenglei <1624952103@qq.com>
Sat, 5 Jul 2025 08:19:54 +0000 (16:19 +0800)
committerpenglei <1624952103@qq.com>
Sat, 5 Jul 2025 08:19:54 +0000 (16:19 +0800)
code/sdk/drivers/peripheral/utils/custom_utils.c

index 3fab3d0..bd367db 100644 (file)
@@ -1466,6 +1466,13 @@ void uapi_set4GCapability(bool isopen)
         {
             return;
         }
+        
+        uint8_t cnt = pm_veto_get_id_cnt(PM_ID_CAT1);
+        if (cnt == 0) 
+        {
+            uapi_pm_add_sleep_veto(PM_ID_CAT1);
+        }
+
         uapi_save_runtime_log(RUNTIME_LOG_CAT1_4G_OPEN);
         power_on_cat1();
         // if(!uapi_dev_runtime_get_saveele_status())
@@ -1487,6 +1494,12 @@ void uapi_set4GCapability(bool isopen)
             }
 
         #endif
+
+        cnt = pm_veto_get_id_cnt(PM_ID_CAT1);
+        if (cnt == 1) 
+        {
+            uapi_pm_remove_sleep_veto(PM_ID_CAT1);
+        }
     }
     else
     {
@@ -1503,12 +1516,6 @@ void uapi_set4GCapability(bool isopen)
         /*4G 开电有时有干扰进日志串口,因此关闭4G才开启日志串口*/
         // uapi_custom_set_uart_rx_enable_flag(true);
         
-        uint8_t cnt = pm_veto_get_id_cnt(PM_ID_CAT1);
-        if (cnt == 1) 
-        {
-            uapi_pm_remove_sleep_veto(PM_ID_CAT1);
-        }
-
         #ifdef SUPPORT_TCPIP
             tcp_thread_id = tcp_get_thread_id();
             if(tcp_thread_id != NULL)
@@ -1520,6 +1527,13 @@ void uapi_set4GCapability(bool isopen)
                     PRINT("tcpip_thread_suspend succed\n");
             }
         #endif
+
+        uint8_t cnt = pm_veto_get_id_cnt(PM_ID_CAT1);
+        if (cnt == 1) 
+        {
+            uapi_pm_remove_sleep_veto(PM_ID_CAT1);
+        }
+
     }
 }