From fedea07c8bbe1d6ee32052dbcc2c44489d01e13f Mon Sep 17 00:00:00 2001 From: Sergey Musikhin <musihin_sergei@mail.ru> Date: Sun, 13 Jun 2021 19:39:41 +0000 Subject: [PATCH] AGC fix --- grc/gen_bladerf_blocks.py | 8 +++----- lib/source_impl.cc | 9 +-------- lib/source_impl.h | 4 ---- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/grc/gen_bladerf_blocks.py b/grc/gen_bladerf_blocks.py index 9257e83..66d0e79 100644 --- a/grc/gen_bladerf_blocks.py +++ b/grc/gen_bladerf_blocks.py @@ -318,8 +318,8 @@ documentation: |- Manual: Keep last estimated correction when switched from Automatic to Manual. Automatic: Periodicallly find the best solution to compensate for image signals. - Gain Mode: - Chooses between the manual (default) and automatic gain mode where appropriate. + AGC: + Chooses between the manual (False) and automatic (True) gain mode where appropriate. To allow manual control of RF/IF gain stages, manual gain mode must be configured. % endif @@ -402,11 +402,9 @@ PARAMS_TMPL = """ - id: gain_mode${n} category: 'Channel ${n}' - label: 'Gain Mode' + label: 'AGC' dtype: bool default: False - options: [False, True] - option_labels: [Manual, Automatic] hide: ${'$'}{'none' if (nchan > ${n}) else 'all'} % endif diff --git a/lib/source_impl.cc b/lib/source_impl.cc index fc53c8e..0fcf59c 100644 --- a/lib/source_impl.cc +++ b/lib/source_impl.cc @@ -158,14 +158,7 @@ namespace gr { bool source_impl::set_gain_mode(bool automatic, size_t chan) { - return gain_mode_.set_if_not_equal(automatic,chan,get_num_channels(), - [this, automatic, chan] - { - bool mode = device_->set_gain_mode(automatic,chan); - if(!automatic) - device_->set_gain(gain_[chan], chan); - return mode; - }); + return device_->set_gain_mode(automatic,chan); } bool source_impl::get_gain_mode(size_t chan) diff --git a/lib/source_impl.h b/lib/source_impl.h index 36d4722..a4b6756 100644 --- a/lib/source_impl.h +++ b/lib/source_impl.h @@ -23,16 +23,12 @@ namespace gr { channel_store<double> center_freq_; channel_store<double> freq_corr_; - channel_store<bool> gain_mode_; channel_store<double> gain_; channel_store<double> if_gain_; channel_store<double> bb_gain_; channel_store<std::string> antenna_; channel_store<double> bandwidth_; - - - public: source_impl(const std::string & args); ~source_impl(); -- GitLab