From 83c37006946f0802c84a8334075c851ea34b6c26 Mon Sep 17 00:00:00 2001 From: zhangsheng Date: Mon, 12 May 2025 10:34:06 +0800 Subject: [PATCH] add code --- uart/uart.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/uart/uart.cpp b/uart/uart.cpp index 7d218bd..ecec87c 100644 --- a/uart/uart.cpp +++ b/uart/uart.cpp @@ -586,6 +586,21 @@ void Uart::DealRecvData(const char *pData) { int taskID = 0; ScheduleTask scheduleTask; zlog_info(zct, "shortAdd = %02x%02x,command = %d ",UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd),command); + if (command == WAVE_COMPRESS || command == UPGRADE_ASK) + { + char localtimestamp[32] = {0}; + GetTimeNet(localtimestamp, 1); + std::string nowTimetamp = std::string(localtimestamp); + long now_time = atol(nowTimetamp.c_str()); + if(ushortAdd == last_short_addr && (now_time - last_time) < 5){ + zlog_warn(zct, "DealFeatureValue short_addr_last = %02x%02x,timestamp_last = %ld,nowTime = %ld",UINT16_HIGH(ushortAdd), UINT16_LOW(ushortAdd),last_time,now_time); + return ; + } + GetTimeNet(localtimestamp, 1); + nowTimetamp = std::string(localtimestamp); + last_time = atol(nowTimetamp.c_str()); + } + if (ushortAdd != last_short_addr){ mssleep(50000); ModifyDistAddr(ushortAdd); @@ -632,8 +647,9 @@ void Uart::DealRecvData(const char *pData) { } break; case WAVE_COMPRESS: - GetLocalZigbeeRSSI(ushortAdd); - DealWaveCompress(pData,ushortAdd); + + GetLocalZigbeeRSSI(ushortAdd); + DealWaveCompress(pData,ushortAdd); break; case UPGRADE_ASK: mssleep(50000);