From d802ff7c94c8fd806043fffd9ca5ba80b55c6693 Mon Sep 17 00:00:00 2001 From: pandx Date: Thu, 3 Apr 2025 09:08:51 +0800 Subject: [PATCH] refine waveerror interface. --- scheduler/schedule.cpp | 8 ++++---- scheduler/schedule.hpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scheduler/schedule.cpp b/scheduler/schedule.cpp index 545fa7e..6d8e538 100644 --- a/scheduler/schedule.cpp +++ b/scheduler/schedule.cpp @@ -394,21 +394,21 @@ SensorScheduler::SensorScheduler() { UpdateCfg::ReadCfg(update_); } -void SensorScheduler::WaveError(int short_addr) { +int SensorScheduler::WaveError(int short_addr) { auto iter = failure_map_.find(short_addr); if (iter == failure_map_.end()) { failure_map_[short_addr] = 3; // 重试次数 zlog_warn(zct, "[WaveError][%x] will try 3 times", short_addr); - return; + return 0; } if (iter->second == 0) { zlog_warn(zct, "[WaveError][%x] no try times", short_addr); failure_map_.erase(short_addr); - return; + return -1; } iter->second = iter->second - 1; zlog_warn(zct, "[WaveError][%x] remain try %d times", short_addr, iter->second); - return; + return 0; } bool SensorScheduler::RetransferWave(uint16_t short_addr) { diff --git a/scheduler/schedule.hpp b/scheduler/schedule.hpp index 08be944..3642d40 100644 --- a/scheduler/schedule.hpp +++ b/scheduler/schedule.hpp @@ -41,7 +41,7 @@ public: int StartSchedule(int short_addr, int &next_duration); int GetNextDuration(int short_addr); - void WaveError(int short_addr); + int WaveError(int short_addr); void WaveSuccess(int short_addr); long GetBaseTimestamp(int id); long CalcNextTimestamp(int id, uint16_t short_addr);