modify zigbee ack timeout

This commit is contained in:
zhangsheng 2024-11-19 15:44:18 +08:00
parent 161de09562
commit 7e2faf2ead
2 changed files with 10 additions and 3 deletions

View File

@ -360,7 +360,9 @@ int Uart::DealAskTask(uint16_t ushortAdd){
} }
else if (taskID == kScheduleUpgrade) //3.升级 else if (taskID == kScheduleUpgrade) //3.升级
{ {
zlog_info(zct, " UpdateWirelessNode 2222" );
UpdateWirelessNode(ushortAdd); UpdateWirelessNode(ushortAdd);
zlog_info(zct, " UpdateWirelessNode end1111" );
}else if (taskID == kScheduleConfigSensor) //4.更新配置 }else if (taskID == kScheduleConfigSensor) //4.更新配置
{ {
scheduleTask.cmd = CONFIG; scheduleTask.cmd = CONFIG;
@ -383,7 +385,7 @@ int Uart::DealAskTask(uint16_t ushortAdd){
scheduleTask.duration = next_duration; scheduleTask.duration = next_duration;
TaskResp(scheduleTask); TaskResp(scheduleTask);
} }
zlog_info(zct, " DealAskTask end" );
return 0; return 0;
} }
@ -520,6 +522,7 @@ void Uart::DealRecvData(const char *pData) {
break; break;
case ASK_TASK: case ASK_TASK:
DealAskTask(ushortAdd); DealAskTask(ushortAdd);
zlog_info(zct, " DealAskTask end11111" );
break; break;
case DEVICE_EXCEPTION: case DEVICE_EXCEPTION:
DealException(pData); DealException(pData);

View File

@ -168,19 +168,22 @@ void Uart::UpdateWirelessNode(uint16_t shortAdd) {
} }
Data[99] = tmp; Data[99] = tmp;
sleep(1); sleep(1);
zlog_info(zct, "111111111");
WriteToUart((const char*)Data, 100); WriteToUart((const char*)Data, 100);
zlog_info(zct, "22222222222");
int iRet = CheckZigbeeACK(); int iRet = CheckZigbeeACK();
zlog_info(zct, "333333333333");
if (iRet == 0) { if (iRet == 0) {
zlog_info(zct, "Packge ACK send success,shortAddr = %02x%02x", UINT16_HIGH(shortAdd), UINT16_LOW(shortAdd)); zlog_info(zct, "Packge ACK send success,shortAddr = %02x%02x", UINT16_HIGH(shortAdd), UINT16_LOW(shortAdd));
} else { } else {
zlog_warn(zct, "Packge ACK send failed,shortAddr = %02x%02x", UINT16_HIGH(shortAdd), UINT16_LOW(shortAdd)); zlog_warn(zct, "Packge ACK send failed,shortAddr = %02x%02x", UINT16_HIGH(shortAdd), UINT16_LOW(shortAdd));
} }
mssleep(10000); mssleep(50000);
int Count = thisSize / 92; int Count = thisSize / 92;
int lastSize = thisSize % 92; int lastSize = thisSize % 92;
unsigned char UpdateData[100] = {0x00}; unsigned char UpdateData[100] = {0x00};
//帧头[3byte] 节点地址[2byte] 数据类型[1byte] 序号[1byte] 数据包[92byte] CRC校验[1byte] //帧头[3byte] 节点地址[2byte] 数据类型[1byte] 序号[1byte] 数据包[92byte] CRC校验[1byte]
zlog_warn(zbt, "Start Update!!! file Size = %d,fileName = %s,Count = %d,lastSize = %d,shortAddr = %02x%02x", (int)thisSize,DataNodeUpdateFile.c_str(),Count,lastSize,UINT16_HIGH(shortAdd), UINT16_LOW(shortAdd)); zlog_warn(zbt, "Start Upgrade!!! file Size = %d,fileName = %s,Count = %d,lastSize = %d,shortAddr = %02x%02x", (int)thisSize,DataNodeUpdateFile.c_str(),Count,lastSize,UINT16_HIGH(shortAdd), UINT16_LOW(shortAdd));
tmp = 0x00; tmp = 0x00;
gpio_set(GlobalConfig::GPIO_G.zigAckreset, 0); gpio_set(GlobalConfig::GPIO_G.zigAckreset, 0);
mssleep(1000); mssleep(1000);
@ -619,6 +622,7 @@ int Uart::CheckZigbeeACK() {
iRet = 0; iRet = 0;
break; break;
} }
time += 1;
mssleep(10000); mssleep(10000);
} while (time < 150); } while (time < 150);
return iRet; return iRet;