refine waveerror interface.

This commit is contained in:
pandx 2025-04-03 09:08:51 +08:00
parent 316068a647
commit d802ff7c94
2 changed files with 5 additions and 5 deletions

View File

@ -394,21 +394,21 @@ SensorScheduler::SensorScheduler() {
UpdateCfg::ReadCfg(update_); UpdateCfg::ReadCfg(update_);
} }
void SensorScheduler::WaveError(int short_addr) { int SensorScheduler::WaveError(int short_addr) {
auto iter = failure_map_.find(short_addr); auto iter = failure_map_.find(short_addr);
if (iter == failure_map_.end()) { if (iter == failure_map_.end()) {
failure_map_[short_addr] = 3; // 重试次数 failure_map_[short_addr] = 3; // 重试次数
zlog_warn(zct, "[WaveError][%x] will try 3 times", short_addr); zlog_warn(zct, "[WaveError][%x] will try 3 times", short_addr);
return; return 0;
} }
if (iter->second == 0) { if (iter->second == 0) {
zlog_warn(zct, "[WaveError][%x] no try times", short_addr); zlog_warn(zct, "[WaveError][%x] no try times", short_addr);
failure_map_.erase(short_addr); failure_map_.erase(short_addr);
return; return -1;
} }
iter->second = iter->second - 1; iter->second = iter->second - 1;
zlog_warn(zct, "[WaveError][%x] remain try %d times", short_addr, iter->second); zlog_warn(zct, "[WaveError][%x] remain try %d times", short_addr, iter->second);
return; return 0;
} }
bool SensorScheduler::RetransferWave(uint16_t short_addr) { bool SensorScheduler::RetransferWave(uint16_t short_addr) {

View File

@ -41,7 +41,7 @@ public:
int StartSchedule(int short_addr, int &next_duration); int StartSchedule(int short_addr, int &next_duration);
int GetNextDuration(int short_addr); int GetNextDuration(int short_addr);
void WaveError(int short_addr); int WaveError(int short_addr);
void WaveSuccess(int short_addr); void WaveSuccess(int short_addr);
long GetBaseTimestamp(int id); long GetBaseTimestamp(int id);
long CalcNextTimestamp(int id, uint16_t short_addr); long CalcNextTimestamp(int id, uint16_t short_addr);