Skip to content

Commit

Permalink
Add pause scan and clear bans
Browse files Browse the repository at this point in the history
  • Loading branch information
neural75 committed Aug 2, 2017
1 parent 55be825 commit e23d1e1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ In sweep mode use a limited bandwidth of about 2 MHz in order to avoid VFO and n
## Interactive Commands
This manual commands are available during scan:
<pre>
[space] OR [enter] : Skips a locked frequency (listening to the next).
'b' : Bans a locked frequency, the bandwidth banned is about 10 Khz from the locked freq.
[space] OR [enter] : Skips a locked frequency (listening to the next).
'b' : Bans a locked frequency, the bandwidth banned is about 10 Khz from the locked freq.
'c' : Clears all banned frequencies.
'p' : Pauses scan on locked frequency, 'p' again to unpause.
</pre>


Expand Down
34 changes: 32 additions & 2 deletions gqrx-scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const long g_ban_tollerance = 10000; // +- Khz bandwidth to ban from cur
// Local Prototypes
//
bool BanFreq (long freq_current);
void ClearAllBans ( void );

//
// Utilities
Expand Down Expand Up @@ -166,6 +167,7 @@ bool WaitUserInputOrDelay (int sockfd, long delay, long *current_freq)
int exit = 0;
char c;
bool skip = false;
bool pause = false;

__fpurge(stdin);
nonblock(NB_ENABLE);
Expand Down Expand Up @@ -194,11 +196,30 @@ bool WaitUserInputOrDelay (int sockfd, long delay, long *current_freq)
skip = true;
break;
}
else if (c == 'c')
{
// Clear all bans
ClearAllBans();
exit = 0;
}
else if (c == 'p')
{
// pause until another 'p'
pause ^= true; // switch pause mode
exit = 0;
}
else
{
exit = 0;
}
}

if (pause)
{
usleep (sleep);
continue;
}

// exit = 0
if (level < squelch )
{
Expand Down Expand Up @@ -440,7 +461,15 @@ bool BanFreq (long freq_current)
return true;
}
//
// TestFreq
// ClearAllBans
//
void ClearAllBans ( void )
{
BannedFreq_Max = 0; // quick and dirty
}

//
// IsBannedFreq
// Test whether a frequency is banned or not
//
bool IsBannedFreq (long *freq_current)
Expand All @@ -454,7 +483,8 @@ bool IsBannedFreq (long *freq_current)
// scanning
*freq_current+= (g_ban_tollerance * 2); // avoid jumping neearby a carrier
// round up to next near tenth of khz 145892125 -> 145900000
*freq_current = ceil( *freq_current / 10000.0 ) * 10000.0;
*freq_current = ceil( *freq_current / 10000.0 ) * 10000.0;
IsBannedFreq (freq_current);
return true;
}
}
Expand Down

0 comments on commit e23d1e1

Please sign in to comment.