Skip to content

Commit

Permalink
fix and test full frequency range coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
anarkiwi committed Feb 18, 2024
1 parent be93d6f commit 9ca1180
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/retuner_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ retuner_impl::retuner_impl(uint64_t samp_rate, uint64_t tune_jitter_hz,
}

void retuner_impl::add_range_(uint64_t freq_start, uint64_t freq_end) {
uint64_t steps = (freq_end - freq_start) / tune_step_hz_ + 1;
// TODO: this could be a vector of steps that could be retuned to
// in random order each time, to implement a frequency hopping scanner.
uint64_t steps = (freq_end - freq_start) / tune_step_hz_ + 2;
tuning_ranges_.push_back({freq_start, freq_end, steps});
}

Expand Down Expand Up @@ -293,10 +295,11 @@ void retuner_impl::parse_tuning_ranges_(const std::string &tuning_ranges) {
}
}
stare_mode_ = tuning_ranges_[0].steps == 1;
tune_freq_ = tuning_ranges_[0].freq_start;
if (stare_mode_) {
tune_freq_ +=
(tuning_ranges_[0].freq_end - tuning_ranges_[0].freq_start) / 2;
} else {
tune_freq_ = tuning_ranges_[0].freq_start;
}
}

Expand Down
2 changes: 2 additions & 0 deletions python/iqtlabs/qa_retune_fft.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,8 @@ def retune_fft(self, fft_roll):
all_df = pd.DataFrame(records)[["t", "f", "v"]]
all_df["v"] = all_df["v"].round(1)
all_df = all_df.sort_values(["t", "f", "v"])
self.assertEqual(all_df["f"].max(), freq_end)
self.assertEqual(all_df["f"].min(), freq_start)

for _, df in all_df.groupby("t"):
# must have plausible unscaled dB value
Expand Down

0 comments on commit 9ca1180

Please sign in to comment.