Skip to content

Commit e23d1e1

Browse files
committed
Add pause scan and clear bans
1 parent 55be825 commit e23d1e1

File tree

2 files changed

+36
-4
lines changed

2 files changed

+36
-4
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ In sweep mode use a limited bandwidth of about 2 MHz in order to avoid VFO and n
3232
## Interactive Commands
3333
This manual commands are available during scan:
3434
<pre>
35-
[space] OR [enter] : Skips a locked frequency (listening to the next).
36-
'b' : Bans a locked frequency, the bandwidth banned is about 10 Khz from the locked freq.
35+
[space] OR [enter] : Skips a locked frequency (listening to the next).
36+
'b' : Bans a locked frequency, the bandwidth banned is about 10 Khz from the locked freq.
37+
'c' : Clears all banned frequencies.
38+
'p' : Pauses scan on locked frequency, 'p' again to unpause.
3739
</pre>
3840

3941

gqrx-scan.c

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const long g_ban_tollerance = 10000; // +- Khz bandwidth to ban from cur
6363
// Local Prototypes
6464
//
6565
bool BanFreq (long freq_current);
66+
void ClearAllBans ( void );
6667

6768
//
6869
// Utilities
@@ -166,6 +167,7 @@ bool WaitUserInputOrDelay (int sockfd, long delay, long *current_freq)
166167
int exit = 0;
167168
char c;
168169
bool skip = false;
170+
bool pause = false;
169171

170172
__fpurge(stdin);
171173
nonblock(NB_ENABLE);
@@ -194,11 +196,30 @@ bool WaitUserInputOrDelay (int sockfd, long delay, long *current_freq)
194196
skip = true;
195197
break;
196198
}
199+
else if (c == 'c')
200+
{
201+
// Clear all bans
202+
ClearAllBans();
203+
exit = 0;
204+
}
205+
else if (c == 'p')
206+
{
207+
// pause until another 'p'
208+
pause ^= true; // switch pause mode
209+
exit = 0;
210+
}
197211
else
198212
{
199213
exit = 0;
200214
}
201215
}
216+
217+
if (pause)
218+
{
219+
usleep (sleep);
220+
continue;
221+
}
222+
202223
// exit = 0
203224
if (level < squelch )
204225
{
@@ -440,7 +461,15 @@ bool BanFreq (long freq_current)
440461
return true;
441462
}
442463
//
443-
// TestFreq
464+
// ClearAllBans
465+
//
466+
void ClearAllBans ( void )
467+
{
468+
BannedFreq_Max = 0; // quick and dirty
469+
}
470+
471+
//
472+
// IsBannedFreq
444473
// Test whether a frequency is banned or not
445474
//
446475
bool IsBannedFreq (long *freq_current)
@@ -454,7 +483,8 @@ bool IsBannedFreq (long *freq_current)
454483
// scanning
455484
*freq_current+= (g_ban_tollerance * 2); // avoid jumping neearby a carrier
456485
// round up to next near tenth of khz 145892125 -> 145900000
457-
*freq_current = ceil( *freq_current / 10000.0 ) * 10000.0;
486+
*freq_current = ceil( *freq_current / 10000.0 ) * 10000.0;
487+
IsBannedFreq (freq_current);
458488
return true;
459489
}
460490
}

0 commit comments

Comments
 (0)