Skip to content

Commit

Permalink
cleaning things up
Browse files Browse the repository at this point in the history
  • Loading branch information
robotastic committed Feb 19, 2024
1 parent e348cd2 commit 2b05816
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
5 changes: 3 additions & 2 deletions trunk-recorder/gr_blocks/signal_detector_cvf_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {

Expand All @@ -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;
Expand Down
20 changes: 11 additions & 9 deletions trunk-recorder/source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down Expand Up @@ -365,7 +371,7 @@ int Source::get_if_gain() {

std::vector<Recorder *> Source::find_conventional_recorders_by_freq(Detected_Signal signal) {
double freq = center + signal.center_freq;
double bandwidth = signal.bandwidth;

std::vector<Recorder *> recorders;
long max_freq_diff = 12500;
for (std::vector<p25_recorder_sptr>::iterator it = digital_conv_recorders.begin(); it != digital_conv_recorders.end(); it++) {
Expand Down Expand Up @@ -406,12 +412,8 @@ std::vector<Recorder *> Source::get_detected_recorders() {
for (std::vector<Detected_Signal>::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<Recorder *> recorders = find_conventional_recorders_by_freq(signal);
for (std::vector<Recorder *>::iterator it = recorders.begin(); it != recorders.end(); it++) {
Recorder *recorder = *it;
Expand Down

0 comments on commit 2b05816

Please sign in to comment.