Skip to content

Commit

Permalink
Merge branch 'l29ah-step'
Browse files Browse the repository at this point in the history
  • Loading branch information
neural75 committed Jul 16, 2022
2 parents 3ad3c3f + b28a3a6 commit 3602ba9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ gqrx-scanner [-h|--host <host>] [-p|--port <port>] [-m|--mode <sweep|bookmark>]
Possible values for <mode>: sweep, bookmark
-f, --freq <freq> Frequency to scan with a range of +- 1MHz.
Default: the current frequency tuned in Gqrx Incompatible with -b, -e
-s, --step <freq> Frequency step <freq> in Hz. Default: 10000
-b, --min <freq> Frequency range begins with this <freq> in Hz. Incompatible with -f
-e, --max <freq> Frequency range ends with this <freq> in Hz. Incompatible with -f
-d, --delay <time> Lingering time in milliseconds before the scanner reactivates. Default 2000
Expand All @@ -59,7 +60,8 @@ gqrx-scanner [-h|--host <host>] [-p|--port <port>] [-m|--mode <sweep|bookmark>]
1 = dd-mm-yy
2 = yy-mm-dd
This feature has not been implemented yet.
-s, --squelch_delta <dB> If set creates bottom squelch just
-q, --squelch_delta <dB> If set creates bottom squelch just
for listening. It may reduce unnecessary squelch audio supress.
Default: 0.0
-t, --tags <"tags"> Filter signals. Match only on frequencies marked with a tag found in "tags"
Expand Down
33 changes: 25 additions & 8 deletions gqrx-scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ int opt_port = 0;
freq_t opt_freq = 0;
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
long opt_speed = 250000;
Expand Down Expand Up @@ -164,6 +165,7 @@ void print_usage ( char *name )
printf (" Default: the current frequency tuned in Gqrx Incompatible with -b, -e\n");
printf ("-b, --min <freq> Frequency range begins with this <freq> in Hz. Incompatible with -f\n");
printf ("-e, --max <freq> Frequency range ends with this <freq> in Hz. Incompatible with -f\n");
printf ("-s, --step <freq> Frequency step <freq> in Hz. Default: %llu\n", g_default_scan_bw);
printf ("-d, --delay <time> Lingering time in milliseconds before the scanner reactivates. Default 2000\n");
//LWVMOBILE: Adding some descriptions for new switches here
printf ("-x, --speed <time> Time in milliseconds for bookmark scan speed. Default 250 milliseconds.\n");
Expand All @@ -173,7 +175,7 @@ void print_usage ( char *name )
printf (" 1 = dd-mm-yy\n");
printf (" 2 = yy-mm-dd\n");
printf (" This feature has not been implemented yet.\n");
printf ("-s, --squelch_delta <dB> If set creates bottom squelch just\n");
printf ("-q, --squelch_delta <dB> If set creates bottom squelch just\n");
printf (" for listening. It may reduce unnecessary squelch audio supress.\n");
printf (" Default: 0.0\n");
//LWVMOBILE: End of new switches here
Expand Down Expand Up @@ -243,6 +245,7 @@ bool ParseInputOptions (int argc, char **argv)
{"freq", required_argument, 0, 'f'},
{"min", required_argument, 0, 'b'},
{"max", required_argument, 0, 'e'},
{"step", required_argument, 0, 's'},
{"tags", required_argument, 0, 't'},
{"delay", required_argument, 0, 'd'},
//LWVMOBILE: adding new entries here
Expand All @@ -256,7 +259,7 @@ bool ParseInputOptions (int argc, char **argv)
int option_index = 0;

//LWVMOBILE: Adding new argument letters to this index
c = getopt_long (argc, argv, "h:p:m:f:b:e:d:t:v:x:y:s:",
c = getopt_long (argc, argv, "h:p:m:f:b:e:d:t:v:x:y:s:q:",
long_options, &option_index);

// warning: I don't know why but required argument are not so "required"
Expand Down Expand Up @@ -416,7 +419,8 @@ bool ParseInputOptions (int argc, char **argv)
print_usage(argv[0]);
}
break;
case 's':
//LWVMOBILE: End new entried
case 'q':
if (optarg[0] == '-')
{
printf ("Error: -%c: option requires an argument\n", c);
Expand All @@ -430,7 +434,6 @@ bool ParseInputOptions (int argc, char **argv)
}
break;

//LWVMOBILE: End new entried
case 't':
if (optarg[0] == '-')
{
Expand All @@ -444,6 +447,20 @@ bool ParseInputOptions (int argc, char **argv)
optind++;
opt_tag_search = true;
break;

case 's':
if (optarg[0] == '-')
{
printf ("Error: -%c: option requires an argument\n", c);
print_usage(argv[0]);
}

if ((opt_scan_bw = atoll(optarg)) == 0)
{
printf ("Error: -%c: Invalid frequency step\n", c);
print_usage(argv[0]);
}
break;
case '?':
/* getopt_long already printed an error message. */
case ':':
Expand Down Expand Up @@ -704,8 +721,8 @@ bool WaitUserInputOrDelay (int sockfd, long delay, freq_t *current_freq)
// restart scanning
*current_freq+=g_ban_tollerance;
// round up to next near tenth of khz 145892125 -> 145900000
*current_freq = ceil( *current_freq / 10000.0 ) * 10000.0;

*current_freq = ceil( *current_freq / (double)opt_scan_bw ) * opt_scan_bw;
#ifndef OSX
__fpurge(stdin);
#else
Expand Down Expand Up @@ -1328,7 +1345,7 @@ bool ScanFrequenciesInRange(int sockfd, freq_t freq_min, freq_t freq_max, freq_t
sweep_count = 0; // reactivates sweep scan
saved_cycle = false;
current_freq = last_freq;
current_freq = ceil( current_freq / 10000.0 ) * 10000.0;
current_freq = ceil( current_freq / (double)opt_scan_bw ) * opt_scan_bw;
}
else // found one
{
Expand Down Expand Up @@ -1448,7 +1465,7 @@ int main(int argc, char **argv) {

if (opt_scan_mode == sweep)
{
ScanFrequenciesInRange(sockfd, opt_min_freq, opt_max_freq, g_default_scan_bw, opt_squelch_delta);
ScanFrequenciesInRange(sockfd, opt_min_freq, opt_max_freq, opt_scan_bw, opt_squelch_delta);
}
else
{
Expand Down

0 comments on commit 3602ba9

Please sign in to comment.