diff --git a/applications/log2file.c b/applications/log2file.c index 761f287..c75bdb2 100644 --- a/applications/log2file.c +++ b/applications/log2file.c @@ -69,4 +69,4 @@ void sys_log_file_backend_init(void) ulog_file_backend_enable(file_be); //必须使能才能有效 } MSH_CMD_EXPORT(sys_log_file_backend_init,log2file); -//INIT_APP_EXPORT(sys_log_file_backend_init); +INIT_APP_EXPORT(sys_log_file_backend_init); diff --git a/applications/ttTR.c b/applications/ttTR.c index c659149..1e1953b 100644 --- a/applications/ttTR.c +++ b/applications/ttTR.c @@ -179,9 +179,10 @@ void tcpRecMQ_thread_entry(void) } else { - LOG_E("received error."); + msg.size=0;//收到数据长度为0表示tcp断开 + rt_mq_send(&TTrx_mq, &msg, sizeof(msg)); + LOG_E("tcp error, close."); break; -// return -RT_ERROR; } } } diff --git a/applications/ttmsg/ttmsg.c b/applications/ttmsg/ttmsg.c index 6f48993..f340365 100644 --- a/applications/ttmsg/ttmsg.c +++ b/applications/ttmsg/ttmsg.c @@ -540,6 +540,9 @@ void recTT_thread_entry() if (rt_mq_recv(&TTrx_mq, &msg, sizeof(msg), RT_WAITING_FOREVER) == RT_EOK) { // LOG_D("%d Bytes received...",msg.size); + if (!msg.size) {//收到数据长度为0表示tcp断开 + break; + } LOG_HEX("tcpTT", 16, msg.data, msg.size); //此处处理接收到数据 rt_uint8_t rec_good[] = { 0x88, 0xAA, 0xBB, 0x88 };//前四字节 @@ -548,9 +551,6 @@ void recTT_thread_entry() LOG_I("ack is good."); } } - if (!isTCPok()) {//TCP断开 - break; - } } } //INIT_COMPONENT_EXPORT(recTT_thread_entry);