From c32c21deae3bcfc225f9902fedbc55750d6ff631 Mon Sep 17 00:00:00 2001 From: grappas Date: Mon, 26 Jun 2023 19:16:44 +0200 Subject: [PATCH 1/3] When no scan range given on bookmark mode It had no clue --- gqrx-scan.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gqrx-scan.c b/gqrx-scan.c index 521c427..023c9fa 100644 --- a/gqrx-scan.c +++ b/gqrx-scan.c @@ -122,8 +122,8 @@ const char *g_bookmarksfile = "~/.config/gqrx/bookmarks.csv"; char *opt_hostname = NULL; int opt_port = 0; freq_t opt_freq = 0; -freq_t opt_min_freq = 0; -freq_t opt_max_freq = 0; +freq_t opt_min_freq = 24482800; +freq_t opt_max_freq = 1766172800; freq_t opt_scan_bw = g_default_scan_bw; long opt_delay = 0; //LWVMOBILE: Changing this variable from 0 to 250 attempt to fix 'no delay argument given' stoppage on bookmark scan //LWVMOBILE: New variables inserted here @@ -988,7 +988,7 @@ bool ScanBookmarkedFrequenciesInRange(int sockfd, freq_t freq_min, freq_t freq_m if (opt_squelch_delta_auto_enable){ squelch_backup = squelch; SetSquelchLevel(sockfd, Frequencies[i].noise_floor + squelch_delta); - printf ("[%s] Freq: %s active [%s],\nLevel: %2.2f/%2.2f, Squelch set: %f ", + printf ("[%s] Freq: %s active [%s],\nLevel: %2.2f/%2.2f, Squelch set: %2.2f ", timestamp, print_freq(current_freq), Frequencies[i].descr, level, squelch, Frequencies[i].noise_floor + squelch_delta); } @@ -996,7 +996,7 @@ bool ScanBookmarkedFrequenciesInRange(int sockfd, freq_t freq_min, freq_t freq_m { squelch_backup = squelch; SetSquelchLevel(sockfd, squelch - squelch_delta); - printf ("[%s] Freq: %s active [%s], Level: %2.2f/%2.2f,\nNoise Floor: %f, Squelch set: %f ", + printf ("[%s] Freq: %s active [%s], Level: %2.2f/%2.2f,\nNoise Floor: %f, Squelch set: %2.2f ", timestamp, print_freq(current_freq), Frequencies[i].descr, level, squelch, Frequencies[i].noise_floor, squelch - squelch_delta); } @@ -1459,7 +1459,7 @@ bool ScanFrequenciesInRange(int sockfd, freq_t freq_min, freq_t freq_max, freq_t SetSquelchLevel(sockfd, squelch - squelch_delta); } time_t hit_time = GetTime(timestamp); - printf ("[%s] Freq: %s active,\nLevel: %2.2f/%2.2f, Squelch set: %f ", + printf ("[%s] Freq: %s active,\nLevel: %2.2f/%2.2f, Squelch set: %2.2f ", timestamp, print_freq(current_freq), level, squelch, Frequencies[i].noise_floor + squelch_delta); fflush(stdout); From c5811194f0d14a3ba32ee6eb5638ee9fedd99235 Mon Sep 17 00:00:00 2001 From: grappas Date: Tue, 27 Jun 2023 18:04:35 +0200 Subject: [PATCH 2/3] malloc moved or none specified removed max & min reverted to 0 --- gqrx-scan.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/gqrx-scan.c b/gqrx-scan.c index 023c9fa..1c84333 100644 --- a/gqrx-scan.c +++ b/gqrx-scan.c @@ -122,8 +122,8 @@ const char *g_bookmarksfile = "~/.config/gqrx/bookmarks.csv"; char *opt_hostname = NULL; int opt_port = 0; freq_t opt_freq = 0; -freq_t opt_min_freq = 24482800; -freq_t opt_max_freq = 1766172800; +freq_t opt_min_freq = 0; +freq_t opt_max_freq = 0; freq_t opt_scan_bw = g_default_scan_bw; long opt_delay = 0; //LWVMOBILE: Changing this variable from 0 to 250 attempt to fix 'no delay argument given' stoppage on bookmark scan //LWVMOBILE: New variables inserted here @@ -1559,7 +1559,6 @@ int main(int argc, char **argv) { if ( (opt_min_freq > opt_max_freq) || // bad range or only min specified (opt_min_freq == 0 && opt_max_freq > 0) || // or only max specified - (opt_min_freq == 0 && opt_max_freq == 0) || // or none specified ((opt_min_freq != 0 && opt_max_freq != 0) && // or they are equal but different from 0 (opt_min_freq == opt_max_freq) ) ) // or only max specified @@ -1571,15 +1570,6 @@ int main(int argc, char **argv) { print_usage(argv[0]); } - if (opt_scan_mode == sweep) - { - size_t freqeuencies_count = (size_t)(((opt_max_freq-opt_min_freq)/opt_scan_bw)+1); - Frequencies = malloc(freqeuencies_count*sizeof(FREQ)); - } - else { - Frequencies = malloc(FREQ_MAX * sizeof(FREQ)); - } - // here min & max could be equal to 0 because the user specified -f flag sockfd = Connect(opt_hostname, opt_port); @@ -1604,6 +1594,15 @@ int main(int argc, char **argv) { } + if (opt_scan_mode == sweep) + { + size_t freqeuencies_count = (size_t)(((opt_max_freq-opt_min_freq)/opt_scan_bw)+1); + Frequencies = malloc(freqeuencies_count*sizeof(FREQ)); + } + else { + Frequencies = malloc(FREQ_MAX * sizeof(FREQ)); + } + strcpy (from, print_freq(opt_min_freq)); strcpy (to, print_freq(opt_max_freq)); printf ("Frequency range set from %s to %s.\n", from, to); From 664cbf922466f27a5317a5c29c128bf3262c5ee2 Mon Sep 17 00:00:00 2001 From: grappas Date: Tue, 27 Jun 2023 20:30:50 +0200 Subject: [PATCH 3/3] Output slight reformat --- gqrx-scan.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gqrx-scan.c b/gqrx-scan.c index 1c84333..085cf1b 100644 --- a/gqrx-scan.c +++ b/gqrx-scan.c @@ -988,7 +988,7 @@ bool ScanBookmarkedFrequenciesInRange(int sockfd, freq_t freq_min, freq_t freq_m if (opt_squelch_delta_auto_enable){ squelch_backup = squelch; SetSquelchLevel(sockfd, Frequencies[i].noise_floor + squelch_delta); - printf ("[%s] Freq: %s active [%s],\nLevel: %2.2f/%2.2f, Squelch set: %2.2f ", + printf ("\n[%s] Freq: %s active [%s],\nLevel: %2.2f/%2.2f, Squelch set: %2.2f ", timestamp, print_freq(current_freq), Frequencies[i].descr, level, squelch, Frequencies[i].noise_floor + squelch_delta); } @@ -996,7 +996,7 @@ bool ScanBookmarkedFrequenciesInRange(int sockfd, freq_t freq_min, freq_t freq_m { squelch_backup = squelch; SetSquelchLevel(sockfd, squelch - squelch_delta); - printf ("[%s] Freq: %s active [%s], Level: %2.2f/%2.2f,\nNoise Floor: %f, Squelch set: %2.2f ", + printf ("\n[%s] Freq: %s active [%s], Level: %2.2f/%2.2f,\nNoise Floor: %f, Squelch set: %2.2f ", timestamp, print_freq(current_freq), Frequencies[i].descr, level, squelch, Frequencies[i].noise_floor, squelch - squelch_delta); } @@ -1389,7 +1389,7 @@ bool ScanFrequenciesInRange(int sockfd, freq_t freq_min, freq_t freq_max, freq_t fflush(stdout); if (opt_verbose) { - printf("Freq: %s Signal: %2.2f Squelch: %2.2f\n", print_freq(current_freq), level, squelch); + printf("\nFreq: %s Signal: %2.2f Squelch: %2.2f\n", print_freq(current_freq), level, squelch); fflush (stdout); } @@ -1459,7 +1459,7 @@ bool ScanFrequenciesInRange(int sockfd, freq_t freq_min, freq_t freq_max, freq_t SetSquelchLevel(sockfd, squelch - squelch_delta); } time_t hit_time = GetTime(timestamp); - printf ("[%s] Freq: %s active,\nLevel: %2.2f/%2.2f, Squelch set: %2.2f ", + printf ("\n[%s] Freq: %s active,\nLevel: %2.2f/%2.2f, Squelch set: %2.2f ", timestamp, print_freq(current_freq), level, squelch, Frequencies[i].noise_floor + squelch_delta); fflush(stdout);