重启TT后网络不正常,缓存后回退版本

This commit is contained in:
CSSC-WORK\murmur 2023-08-21 11:17:40 +08:00
parent 14c09d5134
commit cd37b8f3f9
6 changed files with 31 additions and 18 deletions

View File

@ -14,7 +14,8 @@ maxTTRetryCnt=3
minTTsinal=3
# TT状态检测周期数
minTTPeriCnt=2
compressType=1
# 压缩方式0-不压缩
compressType=0
# 加密方式0-不加密
encrytType=1
# 开窗时间UTC+8,持续时间H。以【,】为分隔符

View File

@ -315,7 +315,7 @@ static void chkAndSendFile_thread_entry()
{
LOG_W("第%d次尝试中TT准备失败重试。", var + 1);
deInitTT();
rt_thread_mdelay(1000);
rt_thread_mdelay(15000);
initTT();
}
else {
@ -404,7 +404,7 @@ static void timeoutFunc(void *parameter)
void initTT_thread_entry()
{
pwTT_thread_entry("1");
rt_thread_mdelay(15000);//wait TT to boot up
while (1)
{
if (!isTTon()) {
@ -444,6 +444,9 @@ void initTT_thread_entry()
}
initThread=RT_NULL;
// list_thread();
// cmd_free();
}
@ -451,9 +454,10 @@ void deInitTT_thread_entry()
{
if (rt_sem_take(shuntDownTT, RT_WAITING_FOREVER) == RT_EOK)
{
deinitThread =RT_NULL;
tcpClose();
rt_hw_stm32_eth_deinit(); //qu激活网口
// rt_thread_mdelay(3000);
pwTT_thread_entry("0");
// if (0&& tmrToPNTT)
// {
@ -462,8 +466,12 @@ void deInitTT_thread_entry()
// }
LOG_W("shunt down TT DONE");
}
initThread=RT_NULL;
deinitThread =RT_NULL;
// list_thread();
// cmd_free();
}
/**

View File

@ -147,9 +147,10 @@ void upSend_thread_entry(void* parameter)
{
SMSG* msg = RT_NULL;
msg = (SMSG*) parameter;
LOG_D("1--%p",msg);
// LOG_HEX("--",16,msg->data,msg->len);
//check status
uint8_t sta = 1;
while (0 && !isTTjh()) //判断TT状态
{
@ -189,22 +190,18 @@ void upSend_thread_entry(void* parameter)
// size_t rst = packMsg(&cfg, tmpmsg->data, msg->len, dout);//packMsgs
LOG_HEX("upSend", 27, dout, rst);
if (rst)
{
while (!isTCPok())
{
rt_thread_mdelay(1000);
}
{LOG_D("2--%p",msg);
if (sendMsg(dout, rst) == RT_EOK)
{
// tcpClose();
LOG_I("send to TT Done.");
}
else//发送失败,实例不存在此种情况
{
{LOG_D("3--%p",msg);
LOG_E("send error, try to cache %d bytes data to file.",msg->len);
cacheDataToFile(msg->data, msg->len);
}
}
list_thread();
return ;
}
/**
@ -221,7 +218,7 @@ RT_WEAK int upSend(uint8_t *din, size_t len)
memset(&msg, 0, sizeof(SMSG));
memcpy(msg.data,din,len);
msg.len=len;
LOG_D("0--%p",&msg);
/* 创建 serial 线程 */
rt_thread_t thread = rt_thread_create("upSend", upSend_thread_entry, (void *) &msg, 1024 * 5, 27, 10);
/* 创建成功则启动线程 */
@ -1018,6 +1015,7 @@ void parseTTData(uint8_t *din, size_t len)
//数据
else
{
resetTM();//非ACK信号才能触发延时逻辑
uint8_t rst = memcmp(ndin,head,10);//只比较到ftype
if (rst)
{

View File

@ -314,9 +314,10 @@ static int webclient_get_data(const char *url)
LOG_D("webclient GET request response data :");
LOG_D("%s", buffer);
tt_parse(buffer);
if (buffer)
{
tt_parse(buffer);
web_free(buffer);
}
@ -438,7 +439,10 @@ void repGetTT_thread_entry(void* parameter)
strcpy(TTinfo->ele,"-");
break;
}
if (url) {
web_free(url);
}
// rt_thread_mdelay(100);
//trans&copy new info to arrBuf

View File

@ -454,10 +454,11 @@ void recTT_thread_entry()
LOG_HEX("TTrec", 27, msg.data, msg.size);
//此处调用处理函数
// LOG_D("try to parse data.");
resetTM();
// resetTM();
parseTTData(msg.data,msg.size);
}
}
LOG_D("close recTT_thread_entry.");
}
//INIT_COMPONENT_EXPORT(recTT_thread_entry);

View File

@ -675,6 +675,7 @@ void rt_hw_stm32_eth_deinit()
// HAL_ETH_DeInit(&EthHandle);
rt_timer_delete(stm32_eth_device.poll_link_timer);
eth_device_deinit(&(stm32_eth_device.parent));
if (Rx_Buff)
{
rt_free(Rx_Buff);