zhunk 1 سال پیش
والد
کامیت
9e9699efe4
1فایلهای تغییر یافته به همراه12 افزوده شده و 14 حذف شده
  1. 12 14
      Application_cbd_apm32f1/applications/dtu_uart2.c

+ 12 - 14
Application_cbd_apm32f1/applications/dtu_uart2.c

@@ -268,12 +268,19 @@ static void dtu_thread_entry_recv(void *parameter)
 {
     struct rx_msg msg;
     rt_memset(&msg, 0, sizeof(msg));
+    rt_err_t result;
+    rt_uint32_t rx_length;
     static int rx_err = 0;
+    static char str_check[2]={'{','}'};
+    static char rx_buffer[512];
+    static char rx_buffer_tmp[512];
+    static char rx_buffer_tmp2[512];
     while(1)
     {
         //
         // 从消息队列中获取被回调函数放入消息队列中的内容
-        int result = rt_mq_recv(&rx_mq_dtu, &msg, sizeof(struct rx_msg), 100);
+        result = rt_mq_recv(&rx_mq_dtu, &msg, sizeof(struct rx_msg), 100);
+        #if 0
         if (result != RT_EOK){
             rx_err ++;
             if(rx_err==15){
@@ -316,7 +323,8 @@ static void dtu_thread_entry_recv(void *parameter)
         }
 
         rt_free(rx_buffer);
-        #if 0
+        #endif
+        #if 1
         if(result == RT_EOK)
         {
 
@@ -328,17 +336,7 @@ static void dtu_thread_entry_recv(void *parameter)
             LOG_D("recv data:%s",rx_buffer);
             if(strstr(rx_buffer,"{")==RT_NULL||strstr(rx_buffer,"}")==RT_NULL)
             {
-                if(device_status.dtype==7)
-                {
-                    HMI_WRITE("sysTest.result.txt=\"%s\"",rx_buffer);
-                }
-
-                if(device_status.dtype==3)
-                {
-                    HMI_WRITE("sysSet.va0.txt=\"%s\"",rx_buffer);
-                    rt_timer_stop(timer_uart2);
-                }
-
+               HMI_WRITE("sysSet.va0.txt=\"%s\"",rx_buffer);
             }
 
             //过滤异常数据
@@ -373,7 +371,7 @@ static void dtu_thread_entry_recv(void *parameter)
 //         else {
 //
 //
-//    }
+    }
 }
 
 // 解析时间戳并返回一个tm结构体