From 2b0581677bbe51f0c2be29f41dbff89111c056c0 Mon Sep 17 00:00:00 2001 From: Luke Berndt Date: Mon, 19 Feb 2024 09:18:49 -0500 Subject: [PATCH] cleaning things up --- .../gr_blocks/signal_detector_cvf_impl.cc | 5 +++-- trunk-recorder/source.cc | 20 ++++++++++--------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/trunk-recorder/gr_blocks/signal_detector_cvf_impl.cc b/trunk-recorder/gr_blocks/signal_detector_cvf_impl.cc index 652e4283c..791b1acba 100644 --- a/trunk-recorder/gr_blocks/signal_detector_cvf_impl.cc +++ b/trunk-recorder/gr_blocks/signal_detector_cvf_impl.cc @@ -234,10 +234,10 @@ void signal_detector_cvf_impl::build_threshold() { float range = d_tmp_pxx[d_fft_len - 1] - d_tmp_pxx[0]; - float median = d_tmp_pxx[d_fft_len / 2]; + - // search specified normized jump + // search specified normalized jump // since we are looking one ahead we want to stop before the end. for (unsigned int i = 0; i < d_fft_len-1; i++) { @@ -248,6 +248,7 @@ void signal_detector_cvf_impl::build_threshold() { } if (d_threshold == 500) { + //float median = d_tmp_pxx[d_fft_len / 2]; /*BOOST_LOG_TRIVIAL(error) << "Could not find threshold - range: " << range << " d_sensitivity: " << d_sensitivity << " Max RSSI: " << d_tmp_pxx[d_fft_len - 1] << " Min RSSI: " << d_tmp_pxx[0]; for (unsigned int i =0; i < 5; i++) { BOOST_LOG_TRIVIAL(error) << "RSSI[" << d_tmp_pxx[d_fft_len - 1 - i] << "] change: " << (d_tmp_pxx[d_fft_len - 1 - i] - d_tmp_pxx[d_fft_len - 2 - i]) / range; diff --git a/trunk-recorder/source.cc b/trunk-recorder/source.cc index 1db10341c..4d9fe916c 100644 --- a/trunk-recorder/source.cc +++ b/trunk-recorder/source.cc @@ -67,11 +67,17 @@ Source::Source(double c, double r, double e, std::string drv, std::string dev, C next_selector_port = 0; recorder_selector = gr::blocks::selector::make(sizeof(gr_complex), 0, 0); + + // parameters for signal_detector_cvf float threshold_sensitivity = 0.95; - if (rate > 3000000) { - threshold_sensitivity = 0.95; - } - signal_detector = signal_detector_cvf::make(rate, 1024, 0, -45, threshold_sensitivity, true, 0.8, 0.01, 0.0, 50000, ""); + float threshold = -45; + int fft_len = 1024; + float average = 0.8; + float quantization = 0.01; + float min_bw = 0.0; + float max_bw = 50000; + + signal_detector = signal_detector_cvf::make(rate, fft_len, 0, threshold, threshold_sensitivity, true, average, quantization, min_bw, max_bw, ""); BOOST_LOG_TRIVIAL(info) << "Made the Signal Detector"; if (driver == "osmosdr") { @@ -365,7 +371,7 @@ int Source::get_if_gain() { std::vector Source::find_conventional_recorders_by_freq(Detected_Signal signal) { double freq = center + signal.center_freq; - double bandwidth = signal.bandwidth; + std::vector recorders; long max_freq_diff = 12500; for (std::vector::iterator it = digital_conv_recorders.begin(); it != digital_conv_recorders.end(); it++) { @@ -406,12 +412,8 @@ std::vector Source::get_detected_recorders() { for (std::vector::iterator it = signals.begin(); it != signals.end(); it++) { Detected_Signal signal = *it; - double freq = center + signal.center_freq; - double bandwidth = signal.bandwidth; // available data but not needed for anything float rssi = signal.max_rssi; - - std::vector recorders = find_conventional_recorders_by_freq(signal); for (std::vector::iterator it = recorders.begin(); it != recorders.end(); it++) { Recorder *recorder = *it;