还原串口接收的超时逻辑

This commit is contained in:
zhangsheng 2024-09-06 09:24:16 +08:00
parent 66b6164d93
commit f0753e8701
2 changed files with 4 additions and 4 deletions

BIN
Cidn-SH

Binary file not shown.

View File

@ -47,9 +47,9 @@ int Uart::UartRecv(int fd, char srcshow,char* buffer)
memset(buff, 0, sizeof(buff)); memset(buff, 0, sizeof(buff));
ret = read_data(fd, buff, BUF_LENGTH, 10); ret = read_data(fd, buff, BUF_LENGTH, 10);
if (ret <= 0 ){ if (ret <= 0 ){
if(!bUpdate && !bUpdateconfig){ if(!bUpdate && !bUpdateconfig && GlobalConfig::EnterZigBeeWaveTransmittingCnt_G > 15){
timeoutflag ++; timeoutflag ++;
if(timeoutflag > 1500){ if(timeoutflag > 300){
LOG_DEBUG("===============0x9999 timeout= %d offSize = %d===============\n",timeoutflag,offSize); LOG_DEBUG("===============0x9999 timeout= %d offSize = %d===============\n",timeoutflag,offSize);
print_info("0x9999 timeout %d===============Size = %d\n",timeoutflag,offSize); print_info("0x9999 timeout %d===============Size = %d\n",timeoutflag,offSize);
FindRecvPackage(offSize, mUartRecvTmpBuf,head); FindRecvPackage(offSize, mUartRecvTmpBuf,head);
@ -69,9 +69,9 @@ int Uart::UartRecv(int fd, char srcshow,char* buffer)
LOG_DEBUG("wave end\n"); LOG_DEBUG("wave end\n");
} }
usleep(10000); usleep(10000);
}else if(bUpdatePre || (bUpdateconfig)){ }else if(bUpdatePre || (bUpdateconfig && GlobalConfig::EnterZigBeeWaveTransmittingCnt_G > 15)){
timeoutflag ++; timeoutflag ++;
if(timeoutflag > 1500){ if(timeoutflag > 300){
print_info("bUpdateconfig %d===============\n",timeoutflag); print_info("bUpdateconfig %d===============\n",timeoutflag);
GlobalConfig::EnterZigBeeWaveTransmittingFlag_G = NO_ENTER_TRANSMITTING_STATUS; GlobalConfig::EnterZigBeeWaveTransmittingFlag_G = NO_ENTER_TRANSMITTING_STATUS;
GlobalConfig::EnterZigBeeWaveTransmittingCnt_G = 0; GlobalConfig::EnterZigBeeWaveTransmittingCnt_G = 0;