|
@@ -268,12 +268,19 @@ static void dtu_thread_entry_recv(void *parameter)
|
|
|
{
|
|
{
|
|
|
struct rx_msg msg;
|
|
struct rx_msg msg;
|
|
|
rt_memset(&msg, 0, sizeof(msg));
|
|
rt_memset(&msg, 0, sizeof(msg));
|
|
|
|
|
+ rt_err_t result;
|
|
|
|
|
+ rt_uint32_t rx_length;
|
|
|
static int rx_err = 0;
|
|
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)
|
|
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){
|
|
if (result != RT_EOK){
|
|
|
rx_err ++;
|
|
rx_err ++;
|
|
|
if(rx_err==15){
|
|
if(rx_err==15){
|
|
@@ -316,7 +323,8 @@ static void dtu_thread_entry_recv(void *parameter)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
rt_free(rx_buffer);
|
|
rt_free(rx_buffer);
|
|
|
- #if 0
|
|
|
|
|
|
|
+ #endif
|
|
|
|
|
+ #if 1
|
|
|
if(result == RT_EOK)
|
|
if(result == RT_EOK)
|
|
|
{
|
|
{
|
|
|
|
|
|
|
@@ -328,17 +336,7 @@ static void dtu_thread_entry_recv(void *parameter)
|
|
|
LOG_D("recv data:%s",rx_buffer);
|
|
LOG_D("recv data:%s",rx_buffer);
|
|
|
if(strstr(rx_buffer,"{")==RT_NULL||strstr(rx_buffer,"}")==RT_NULL)
|
|
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 {
|
|
// else {
|
|
|
//
|
|
//
|
|
|
//
|
|
//
|
|
|
-// }
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 解析时间戳并返回一个tm结构体
|
|
// 解析时间戳并返回一个tm结构体
|