This commit is contained in:
zhangsheng 2026-02-28 22:29:46 +08:00
parent 7df0cad3d3
commit c06fa6af06
3 changed files with 30 additions and 22 deletions

View File

@ -654,7 +654,8 @@ void Uart::DealRecvData(const char *pData) {
nowTimetamp = std::string(localtimestamp); nowTimetamp = std::string(localtimestamp);
last_time = atol(nowTimetamp.c_str()); last_time = atol(nowTimetamp.c_str());
} }
if (ushortAdd != last_short_addr){ //if (ushortAdd != last_short_addr)
{
mssleep(50000); mssleep(50000);
ModifyDistAddr(ushortAdd); ModifyDistAddr(ushortAdd);
mssleep(50000); mssleep(50000);

View File

@ -705,10 +705,17 @@ std::vector<float> Uart::DealData(int iChannel, float coe, unsigned int sampleRa
waveCount = VecWaveDataZ.size(); waveCount = VecWaveDataZ.size();
} }
waveCount = m_waveCountZ; waveCount = m_waveCountZ;
printf("\n");
for (; j < waveCount; j++) { for (; j < waveCount; j++) {
RecvData recvData = g_VecWaveDataZ[j]; RecvData recvData = g_VecWaveDataZ[j];
memcpy(data + j * 92, recvData.Data, 92); memcpy(data + j * 92, recvData.Data, 92);
if (j + 3 > waveCount)
{
printf("%02x ",recvData.Order);
} }
}
printf("\n");
memset(buf, 0x00, sizeof(buf)); memset(buf, 0x00, sizeof(buf));
sprintf(buf, "%02x%02x", g_VecWaveDataZ[0].ShortAddr[0], g_VecWaveDataZ[0].ShortAddr[1]); sprintf(buf, "%02x%02x", g_VecWaveDataZ[0].ShortAddr[0], g_VecWaveDataZ[0].ShortAddr[1]);
strShortAddr = std::string(buf); strShortAddr = std::string(buf);

View File

@ -599,13 +599,13 @@ int Uart::TaskResp(ScheduleTask scheduleTask){
mssleep(50000); mssleep(50000);
WriteToUart((const char*)send_data, 100); WriteToUart((const char*)send_data, 100);
int iRet = CheckZigbeeACK(); // int iRet = CheckZigbeeACK();
if (iRet == 0) { // if (iRet == 0) {
zlog_info(zct, "TaskResp ACK send success,shortAddr = %02x%02x", UINT16_HIGH(scheduleTask.shortAddr),UINT16_LOW(scheduleTask.shortAddr)); // zlog_info(zct, "TaskResp ACK send success,shortAddr = %02x%02x", UINT16_HIGH(scheduleTask.shortAddr),UINT16_LOW(scheduleTask.shortAddr));
} else { // } else {
zlog_warn(zct, "TaskResp ACK send failed,shortAddr = %02x%02x", UINT16_HIGH(scheduleTask.shortAddr),UINT16_LOW(scheduleTask.shortAddr)); // zlog_warn(zct, "TaskResp ACK send failed,shortAddr = %02x%02x", UINT16_HIGH(scheduleTask.shortAddr),UINT16_LOW(scheduleTask.shortAddr));
} // }
return iRet; return 0;
} }
int Uart::SendReviveDuration(ReviveDuration recvDuration){ int Uart::SendReviveDuration(ReviveDuration recvDuration){
@ -626,13 +626,13 @@ int Uart::SendReviveDuration(ReviveDuration recvDuration){
} }
UpdateData[99] = tmp; UpdateData[99] = tmp;
WriteToUart((const char*)UpdateData, 100); WriteToUart((const char*)UpdateData, 100);
int iRet = CheckZigbeeACK(); // int iRet = CheckZigbeeACK();
if (iRet == 0) { // if (iRet == 0) {
zlog_info(zct, "SendReviveDuration ACK send success,shortAddr = %d", recvDuration.shortAddr); // zlog_info(zct, "SendReviveDuration ACK send success,shortAddr = %d", recvDuration.shortAddr);
} else { // } else {
zlog_warn(zct, "SendReviveDuration ACK send failed,shortAddr = %d", recvDuration.shortAddr); // zlog_warn(zct, "SendReviveDuration ACK send failed,shortAddr = %d", recvDuration.shortAddr);
} // }
return iRet; return 0;
} }
int Uart::WaveResp(uint16_t shortAddr){ int Uart::WaveResp(uint16_t shortAddr){
unsigned char sendData[8] = {0}; unsigned char sendData[8] = {0};
@ -653,13 +653,13 @@ int Uart::WaveResp(uint16_t shortAddr){
WriteToUart((const char*)sendData, 8); WriteToUart((const char*)sendData, 8);
mssleep(50000); mssleep(50000);
WriteToUart((const char*)sendData, 8); WriteToUart((const char*)sendData, 8);
int iRet = CheckZigbeeACK(); // int iRet = CheckZigbeeACK();
if (iRet == 0) { // if (iRet == 0) {
zlog_info(zct, "WaveResp ACK send success,shortAddr = %x", shortAddr); // zlog_info(zct, "WaveResp ACK send success,shortAddr = %x", shortAddr);
} else { // } else {
zlog_warn(zct, "WaveResp ACK send failed,shortAddr = %x", shortAddr); // zlog_warn(zct, "WaveResp ACK send failed,shortAddr = %x", shortAddr);
} // }
return iRet; return 0;
} }
int Uart::CheckZigbeeACK() { int Uart::CheckZigbeeACK() {
if (gpio_read(GlobalConfig::GPIO_G.zigAckrep) == 48) gpio_set(GlobalConfig::GPIO_G.zigAckreset, 1); if (gpio_read(GlobalConfig::GPIO_G.zigAckrep) == 48) gpio_set(GlobalConfig::GPIO_G.zigAckreset, 1);