雷鸟,开机自动开4G , 默认AT指令模式 2293/1 2293/head
author孙春阳 <snickersun@163.com>
Thu, 18 Sep 2025 04:13:22 +0000 (12:13 +0800)
committer孙春阳 <snickersun@163.com>
Thu, 18 Sep 2025 04:13:22 +0000 (12:13 +0800)
code/sdk/zhihui/ppp/example/ppp_at_cmd.c
code/sdk/zhihui/ppp/example/ppp_example.c
code/sdk/zhihui/ppp/include/ppp_example.h
code/sdk/zhihui/utils/custom_utils.c

index e71376e..f2f92e2 100644 (file)
@@ -757,6 +757,7 @@ static errcode_t at_ppp_env_init(uint8_t *para, uint32_t paraLen)
     int ret = ppp_env_init();
     if (ret == 0) {
         ppp_print_info("PPP ENV INIT: PPP environment initialized successfully (AT mode)\n");
+        ppp_env_init_monitor_task();
         return ERRCODE_SUCC;
     } else {
         ppp_print_err("PPP ENV INIT: Failed to initialize PPP environment, error: %d\n", ret);
index 7334b3a..844d5c6 100644 (file)
@@ -66,15 +66,6 @@ int ppp_env_init(void)
         return -1;
     }
 
-    /* 4. 创建网络监控任务 */
-    PRINT("Creating network monitor task...\r\n");
-    g_monitor_task = osal_kthread_create(network_monitor_task, NULL, "net_monitor", (2048+1024));  // 恢复原始栈大小,AT函数已优化
-    if (g_monitor_task == NULL) {
-        PRINT("Failed to create monitor task\r\n");
-        zhihui_ppp_deinit();
-        return -1;
-    }
-
     g_ppp_env_initialized = true;
     PRINT("PPP environment initialized successfully (AT mode)\r\n");
     if (ppp_is_4g_power_initialized()) {
@@ -88,6 +79,22 @@ int ppp_env_init(void)
 
 }
 
+int ppp_env_init_monitor_task(void)
+{
+    /* 4. 创建网络监控任务 */
+    if (g_monitor_task != NULL) {
+        PRINT("Monitor task already exists\r\n");
+        return 0;
+    }
+    PRINT("Creating network monitor task...\r\n");
+    g_monitor_task = osal_kthread_create(network_monitor_task, NULL, "net_monitor", (2048+1024));  // 恢复原始栈大小,AT函数已优化
+    if (g_monitor_task == NULL) {
+        PRINT("Failed to create monitor task\r\n");
+        return -1;
+    }
+    return 0;
+}
+
 /**
  * @brief 开始PPP拨号(异步版本,不阻塞AT命令线程)
  * @return 0成功启动拨号,-1失败
index a79021b..e4c4fbf 100644 (file)
@@ -62,14 +62,14 @@ int ppp_test_stop_dial(void);
  */
 int ppp_env_deinit(void);
 
+
 /**
- * @brief PPP拨号示例主函数
- * 
- * 使用新的模块化函数实现的示例主函数,展示完整的PPP使用流程。
+ * @brief 初始化网络监控任务
  * 
  * @return 0成功,-1失败
  */
-int ppp_example_main(void);
+int ppp_env_init_monitor_task(void);
+
 
 #ifdef __cplusplus
 }
index 795b500..ffe74d9 100644 (file)
@@ -670,18 +670,6 @@ void startup_post_init_task(void)
     system_init_uart();//配置uartat
 #endif
 
-#ifdef BOARD_LEINIAO
-    // zhihui_ppp_init();
-#else
-    if ( cm_poweron_cat1_on_bootup_flag() )
-    {
-        PRINT("PowerOn Cat1 !\r\n");
-        uapi_set4GCapability(true);       
-    }else{
-        PRINT("PowerOff Cat1 !\r\n");
-        uapi_set4GCapability(false);
-    }
-#endif
     uapi_gei_btmac_and_chipinfo();
 
     uint8_t buildversion[128]={0};
@@ -698,6 +686,23 @@ void startup_post_init_task(void)
     {
         CustomEventPublish(TOPIC_EVENT_NEXTDAY_UPDATE, NULL , 0);
     }
+
+
+    
+#ifdef BOARD_LEINIAO
+    extern int ppp_env_init(void);
+    ppp_env_init();
+#else
+if ( cm_poweron_cat1_on_bootup_flag() )
+{
+    PRINT("PowerOn Cat1 !\r\n");
+    uapi_set4GCapability(true);       
+}else{
+    PRINT("PowerOff Cat1 !\r\n");
+    uapi_set4GCapability(false);
+}
+#endif
+
 #ifdef A5133_DEMO_SERVER
     uapi_button_register_event_cb(a5133_demo_msg_unbind_callback, BUTTON_PWR_CLICKUP_2);
     a5133_demo_msg_change_callback();