cat1升级限制修改 1454/2
authorhcj <1224667075@qq.com>
Sat, 23 Nov 2024 08:55:33 +0000 (16:55 +0800)
committerhcj <1224667075@qq.com>
Sat, 23 Nov 2024 08:55:33 +0000 (16:55 +0800)
cat1modem/src/main.py
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/cat1ota/Cat1pyVersion.txt [new file with mode: 0644]
code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp

index 0f8b84a..fa20465 100644 (file)
@@ -6,16 +6,19 @@ try:
     except Exception as e:
         main_flag = 0
         print("启动失败!!!!!\r\n".format(e),'slipservice') 
+        
     try:       
         from usr.tcpService import TcpService
     except Exception as e:
         main_flag = 0
         print("启动失败!!!!!\r\n".format(e),'tcpService') 
+        
     try:    
         import usr.checkota
     except Exception as e:
         main_flag = 0
         print("启动失败!!!!!\r\n".format(e),'checkota') 
+        
     example.exec('/usr/main_init.py')
     print("启动成功!!!!!\r\n")
 except Exception as e:
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/cat1ota/Cat1pyVersion.txt b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/cat1ota/Cat1pyVersion.txt
new file mode 100644 (file)
index 0000000..19c7bdb
--- /dev/null
@@ -0,0 +1 @@
+16
\ No newline at end of file
index 3ed7a45..4599a85 100644 (file)
@@ -247,7 +247,11 @@ static uint8_t g_time_synced = 0;
 #define MAX_TIME_SYNC_RETRY_TIME 5
 static uint8_t g_time_sync_retry_time = 0;
 
-#define  PY_SRV_VER_CURRENT 15
+
+static uint8_t need_py_srv_ver_txt = 0;
+
+#define  PY_SRV_VER_CURRENT  16
+
 
 #define  PY_SRV_VER_SUPORT_PY_OTA_MINI_VER 13
 
@@ -755,7 +759,23 @@ static int decodeNetStat(char* msg)
     if ( g_python_updated == 0)
     {
          /**升级开始,马上设置 */
-        if (g_py_ver >= PY_SRV_VER_SUPORT_PY_OTA_MINI_VER && g_py_ver != PY_SRV_VER_CURRENT) 
+        // if(>=16)
+        // /home/hcj/FD230/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/system/cat1ota/Cat1pyVersion.txt
+
+        FILE *fp= fopen("/user/system/cat1ota/Cat1pyVersion.txt","rb+");
+        if(fp)
+        {
+            char read_buf[32]={0};
+            int read_size=fread(read_buf,1,32,fp);
+            if(read_size)
+            {
+                need_py_srv_ver_txt=atoi(read_buf);
+            }
+            fclose(fp);
+        }
+    
+        
+        if (g_py_ver >= PY_SRV_VER_SUPORT_PY_OTA_MINI_VER && (g_py_ver < PY_SRV_VER_CURRENT ) || g_py_ver<need_py_srv_ver_txt ) 
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"start cat1 python ota\n");
             Cat1_OTA(CAT1_TCP_START_OTA);
@@ -808,7 +828,7 @@ void cat1_call_hungup(void)
 void cat1_call_answer(void)
 {
     #if PY_SRV_VER_CURRENT >=16
-    if(g_py_ver>=16)
+   if(g_py_ver>=16)
     {
         if(osTimerIsRunning(g_timer_time_answer)==0  )
         {
@@ -1352,6 +1372,12 @@ static int udp_packet_parse(char *rx_buffer, int len)
             index = cat1_handle_timesync(msg_buffer);
             break;
         case UDP_MSG_CALL_CONNECTED:
+            if(g_timer_time_answer)
+            osTimerStop(g_timer_time_answer);
+
+            if(g_timer_time_Dial)
+            osTimerStop(g_timer_time_Dial);
+
             index = cat1_handle_call_connected(msg_buffer);
             break;
         case UDP_MSG_CALL_DISCONNECTED: