modify ugrade node

This commit is contained in:
zhangsheng 2026-03-10 08:47:57 +08:00
parent 80d84f927f
commit afa8ddeb63
2 changed files with 31 additions and 22 deletions

View File

@ -285,21 +285,30 @@ int Uart::ReadFromUart() {
int Uart::ReadFromAlarm(){
char buffer[100] = {0x00};
int len = read_data(fd, (char *)buffer, 100, 10);
printf( "ReadFromAlarm len = %d\n", len);
for (int i = 0; i < len; i++) printf( "%02X ", buffer[i] & 0xFF);
printf( "print end\n");
zlog_info(zct, "==========ReadFromAlarm========len = %d", len);
char head[] = {0xA5, 0x5A, 0xA5};
if (len > 0)
{
for (int i = 0; i < len; i++) {
printf( "%02x ", buffer[i] & 0xff);
}
if(buffer[5] == 0x02 && buffer[6] == 0x01){
return 0 ;
}else{
return 1 ;
}
}else {
return 1 ;
}
if (buffer[i] == head[0]) {
char buf[12] = {0x00};
sprintf(buf, "%02X%02X%02X", buffer[i] & 0xFF,buffer[i + 1] & 0xFF,buffer[i + 2] & 0xFF);
std::string strHeadFlag(buf);
if (0 == strHeadFlag.compare("A55AA5")) {
if(buffer[i + 5] == 0x02 && buffer[i + 6] == 0x01){
return 0 ;
}else{
continue;
}
}
}
}
}
return 1 ;
}
void Uart::Run() { mIoSev.run(); }

View File

@ -437,12 +437,12 @@ int Uart::UpdateConfig(uint16_t ushortAdd) {
UpdateData[99] = tmp1;
tcflush(fd, TCIFLUSH);
WriteToUart((const char*)UpdateData, 100);
int iRet = CheckZigbeeACK();
if (iRet == 0) {
zlog_info(zct, "updateconfig ACK send success,shortAddr = %02x%02x", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd));
} else {
zlog_warn(zct, "updateconfig ACK send failed,shortAddr = %02x%02x", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd));
}
// int iRet = CheckZigbeeACK();
// if (iRet == 0) {
// zlog_info(zct, "updateconfig ACK send success,shortAddr = %02x%02x", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd));
// } else {
// zlog_warn(zct, "updateconfig ACK send failed,shortAddr = %02x%02x", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd));
// }
mssleep(50000);
std::string strName = sqlite_db_ctrl::instance().GetData(T_SENSOR_INFO(TNAME), " dataNodeName ", whereCon);
@ -475,12 +475,12 @@ int Uart::UpdateConfig(uint16_t ushortAdd) {
UpdateData[99] = tmp1;
tcflush(fd, TCIFLUSH);
WriteToUart((const char*)UpdateData, 100);
int iRet = CheckZigbeeACK();
if (iRet == 0) {
zlog_info(zct, "updataname ACK send success,shortAddr = %02x%02x", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd));
} else {
zlog_warn(zct, "updataname ACK send failed,shortAddr = %02x%02x", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd));
}
// int iRet = CheckZigbeeACK();
// if (iRet == 0) {
// zlog_info(zct, "updataname ACK send success,shortAddr = %02x%02x", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd));
// } else {
// zlog_warn(zct, "updataname ACK send failed,shortAddr = %02x%02x", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd));
// }
return 0;
}
return 0;