diff --git a/applications/core.c b/applications/core.c index b57630a..3a7970e 100644 --- a/applications/core.c +++ b/applications/core.c @@ -589,6 +589,7 @@ static void chkAndSendFile_thread_entry() if (rt_event_recv(&chkSta, FILE_IS_OK | TIMER_IS_OUT, RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR, RT_WAITING_FOREVER, RT_NULL) == RT_EOK) //条件1满足 { + isFileMode=1; LOG_I("等待TT就绪"); LOG_I("当前规则为:连续%d个采集周期TT信号质量不低于%d",scfg.minTTPeriCnt,scfg.minTTsinal); initTT(); @@ -764,7 +765,7 @@ void deInitTT_thread_entry() clearWindowMode(); // setManualWindow(-1); setWorkSta(0); - isFileMode=0; +// isFileMode=0; LOG_W("shunt down TT DONE"); } // initThread = RT_NULL; @@ -786,7 +787,7 @@ void initTT() } set3SRTC(); setWorkSta(1); - isFileMode=1; +// isFileMode=1; initThread = rt_thread_create("initTT", initTT_thread_entry, RT_NULL, 1024 * 5, 25, 10); /* 创建成功则启动线程 */ if (initThread != RT_NULL) diff --git a/applications/ttTR/ttTR.c b/applications/ttTR/ttTR.c index b056578..fee6c24 100644 --- a/applications/ttTR/ttTR.c +++ b/applications/ttTR/ttTR.c @@ -132,7 +132,7 @@ int tcpRec(unsigned char *recv_data) struct rt_messagequeue TTrx_mq; void init_mq(void) { - static char msg_pool[1024*5]; + static char msg_pool[1024*1]; /* 初始化消息队列 */ int result = rt_mq_init(&TTrx_mq, "TTrx_mq", msg_pool, /* 存放消息的缓冲区 */ @@ -146,7 +146,11 @@ void init_mq(void) } } INIT_COMPONENT_EXPORT(init_mq); - +static uint8_t TCPrxBuffer[BUFSZ]; +void readTCPData(uint8_t *dout, size_t cnt) +{ + memcpy(dout,TCPrxBuffer,cnt); +} /** * 接收TCP数据,通过消息队列发出通知 * @param recv_data 接收数据缓存,最小200字节 @@ -163,7 +167,7 @@ void tcpRecMQ_thread_entry(void) } rt_memset(&msg, 0, sizeof(msg)); /* 从sock连接中接收最大BUFSZ字节数据 */ - msg.size = recv(sock, msg.data, BUFSZ, 0); + msg.size = recv(sock, TCPrxBuffer, BUFSZ, 0); // if (msg.size < 0) // { // /* 接收失败,关闭这个连接 */ diff --git a/applications/ttTR/ttTR.h b/applications/ttTR/ttTR.h index e03901d..37a7004 100644 --- a/applications/ttTR/ttTR.h +++ b/applications/ttTR/ttTR.h @@ -14,7 +14,7 @@ //struct rt_messagequeue TTrx_mq; typedef struct { - rt_uint8_t data[400]; +// rt_uint8_t data[400]; int size; }TTRx_MSG; diff --git a/applications/ttmsg/ttmsg.c b/applications/ttmsg/ttmsg.c index ca78d71..a6df7cf 100644 --- a/applications/ttmsg/ttmsg.c +++ b/applications/ttmsg/ttmsg.c @@ -456,11 +456,13 @@ void recTT_thread_entry() { //收到数据长度为0表示tcp断开 break; } + readTCPData(bf, msg.size); LOG_I("%d Bytes received from TT",msg.size); - LOG_HEX("TTrec", 27, msg.data, msg.size); + LOG_HEX("TTrec", 27, bf, msg.size); //复制数据 - memcpy(bf,msg.data,msg.size); + +// memcpy(bf,msg.data,msg.size); dlen=msg.size; //存入log char tmp[1024]="";//接收的数据不会很长,200足矣