fix upgrade schedule bug.

This commit is contained in:
pandx 2026-02-07 18:52:22 +08:00
parent cd1b6dd1eb
commit 3ed6961b81

View File

@ -1350,15 +1350,17 @@ void SensorScheduler::GenerateUpgradeSchedule() {
long current_ts = GetLocalTs(); long current_ts = GetLocalTs();
long nth_wave_start_slice = abs(current_ts - start_timestamp_) / wave_form_send_interval_; long nth_wave_start_slice = abs(current_ts - start_timestamp_) / wave_form_send_interval_;
zlog_debug(zbt, "current ts: %ld, start ts:%ld", current_ts, start_timestamp_); zlog_debug(zbt, "current ts: %ld, start ts:%ld, wave_form_send_interval_:%d", current_ts, start_timestamp_, wave_form_send_interval_);
long current_wave_start_ts = nth_wave_start_slice * wave_form_send_interval_ + start_timestamp_; long current_wave_start_ts = nth_wave_start_slice * wave_form_send_interval_ + start_timestamp_;
long seconds_in_current_wave_slice = current_ts_ - current_wave_start_ts; long seconds_in_current_wave_slice = current_ts - current_wave_start_ts;
long nth_eigen_value_slice = seconds_in_current_wave_slice / eigen_value_send_interval_; long nth_eigen_value_slice = seconds_in_current_wave_slice / eigen_value_send_interval_;
long seconds_in_current_eigen_slice = seconds_in_current_wave_slice % eigen_value_send_interval_; long seconds_in_current_eigen_slice = seconds_in_current_wave_slice % eigen_value_send_interval_;
int previous_wave_slice = wave_slice_num_per_eigen_interval_ * (nth_eigen_value_slice + 1); int previous_wave_slice = wave_slice_num_per_eigen_interval_ * (nth_eigen_value_slice + 1);
if (previous_wave_slice < 0) { zlog_debug(zbt, "seconds_in_current_wave_slice:%d, nth_eigen_value_slice:%d, seconds_in_current_eigen_slice:%d, previous_wave_slice: %d",
zlog_error(zbt, "previous_wave_slice: %d", previous_wave_slice); seconds_in_current_wave_slice, nth_eigen_value_slice, seconds_in_current_eigen_slice, previous_wave_slice);
} // if (previous_wave_slice < 0) {
// zlog_error(zbt, "previous_wave_slice: %d", previous_wave_slice);
// }
if (previous_wave_slice == available_slice_) { if (previous_wave_slice == available_slice_) {
previous_wave_slice = 0; previous_wave_slice = 0;
} }
@ -1377,7 +1379,6 @@ void SensorScheduler::GenerateUpgradeSchedule() {
int j = 0; int j = 0;
// int k = 0; // int k = 0;
for (int i = previous_wave_slice+1; i < previous_wave_slice+1+available_slice_; i=i+2) { for (int i = previous_wave_slice+1; i < previous_wave_slice+1+available_slice_; i=i+2) {
j = i % available_slice_+1; j = i % available_slice_+1;
if (j == 0) { if (j == 0) {
j = 1; j = 1;