From 687615e0d73c97ba06bf3647ddee8134d674ab3f Mon Sep 17 00:00:00 2001 From: Luke Berndt Date: Fri, 14 Jun 2024 08:00:19 -0400 Subject: [PATCH] changing max_dev also effects channel bandwidth for analog --- trunk-recorder/config.cc | 2 +- trunk-recorder/gr_blocks/xlat_channelizer.cc | 7 ++++++- trunk-recorder/gr_blocks/xlat_channelizer.h | 2 ++ trunk-recorder/recorders/analog_recorder.cc | 4 +--- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/trunk-recorder/config.cc b/trunk-recorder/config.cc index 0b46263d3..9b7ecdac4 100644 --- a/trunk-recorder/config.cc +++ b/trunk-recorder/config.cc @@ -293,7 +293,7 @@ bool load_config(string config_file, Config &config, gr::top_block_sptr &tb, std double digital_levels = element.value("digitalLevels", 1.0); double analog_levels = element.value("analogLevels", 8.0); double squelch_db = element.value("squelch", -160.0); - int max_dev = element.value("maxDev", 6000); + int max_dev = element.value("maxDev", 4000); double filter_width = element.value("filterWidth", 1.0); bool conversation_mode = element.value("conversationMode", true); bool mod_exists = element.contains("modulation"); diff --git a/trunk-recorder/gr_blocks/xlat_channelizer.cc b/trunk-recorder/gr_blocks/xlat_channelizer.cc index 9ad820623..82cb1392f 100644 --- a/trunk-recorder/gr_blocks/xlat_channelizer.cc +++ b/trunk-recorder/gr_blocks/xlat_channelizer.cc @@ -57,7 +57,7 @@ xlat_channelizer::xlat_channelizer(double input_rate, int samples_per_symbol, do const float pi = M_PI; int initial_decim = floor(input_rate / 96000); - double initial_rate = double(input_rate) / double(initial_decim); + initial_rate = double(input_rate) / double(initial_decim); int decim = floor(initial_rate / channel_rate); double resampled_rate = double(initial_rate) / double(decim); @@ -171,6 +171,11 @@ void xlat_channelizer::tune_offset(double f) { freq_xlat->set_center_freq(-freq); } +void xlat_channelizer::set_max_dev(double max_dev) { + std::vector channel_lpf_taps = gr::filter::firdes::low_pass_2(1.0, initial_rate, max_dev, d_bandwidth / 2, 60); + channel_lpf->set_taps(channel_lpf_taps); +} + void xlat_channelizer::set_squelch_db(double squelch_db) { squelch->set_threshold(squelch_db); } diff --git a/trunk-recorder/gr_blocks/xlat_channelizer.h b/trunk-recorder/gr_blocks/xlat_channelizer.h index 22bd314b6..673fa7b88 100644 --- a/trunk-recorder/gr_blocks/xlat_channelizer.h +++ b/trunk-recorder/gr_blocks/xlat_channelizer.h @@ -62,6 +62,7 @@ class xlat_channelizer : public gr::hier_block2 { void set_samples_per_symbol(int samples_per_symbol); void set_squelch_db(double squelch_db); void set_analog_squelch(bool analog_squelch); + void set_max_dev(double max_dev); private: bool double_decim; @@ -76,6 +77,7 @@ class xlat_channelizer : public gr::hier_block2 { bool d_use_squelch; long symbol_rate; + double initial_rate; double squelch_db; long decim; diff --git a/trunk-recorder/recorders/analog_recorder.cc b/trunk-recorder/recorders/analog_recorder.cc index 9dd3896c6..e6d0f7617 100644 --- a/trunk-recorder/recorders/analog_recorder.cc +++ b/trunk-recorder/recorders/analog_recorder.cc @@ -362,9 +362,7 @@ bool analog_recorder::start(Call *call) { levels->set_k(system->get_analog_levels()); int d_max_dev = system->get_max_dev(); - /* - channel_lpf_taps = gr::filter::firdes::low_pass_2(1.0, initial_rate, d_max_dev, 1000, 100); - channel_lpf->set_taps(channel_lpf_taps);*/ + prefilter->set_max_dev(d_max_dev); quad_gain = system_channel_rate / (2.0 * M_PI * (d_max_dev + 1000)); demod->set_gain(quad_gain); int offset_amount = (center_freq - chan_freq);