更新TTrx_mq逻辑

修复isFileMode的bug
This commit is contained in:
CSSC-WORK\murmur 2023-09-16 17:09:24 +08:00
parent e1a6834a93
commit 874a3dacb5
4 changed files with 15 additions and 8 deletions

View File

@ -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)

View File

@ -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)
// {
// /* 接收失败,关闭这个连接 */

View File

@ -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;

View File

@ -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足矣