mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-11-07 14:50:48 -05:00
Scripts API: SuperScanner: avoid console message flood when there are unserved frequencies
This commit is contained in:
parent
3bd954f26f
commit
dd78ae98d9
@ -24,6 +24,7 @@ WS_URI = None
|
|||||||
PASS_INDEX = 0
|
PASS_INDEX = 0
|
||||||
PSD_FLOOR = []
|
PSD_FLOOR = []
|
||||||
CONFIG = {}
|
CONFIG = {}
|
||||||
|
UNSERVED_FREQUENCIES = []
|
||||||
|
|
||||||
# ======================================================================
|
# ======================================================================
|
||||||
class SuperScannerError(Exception):
|
class SuperScannerError(Exception):
|
||||||
@ -280,6 +281,7 @@ def get_hotspot_frequency(channel, hotspot):
|
|||||||
# ======================================================================
|
# ======================================================================
|
||||||
def process_hotspots(scanned_hotspots):
|
def process_hotspots(scanned_hotspots):
|
||||||
global CONFIG
|
global CONFIG
|
||||||
|
global UNSERVED_FREQUENCIES
|
||||||
if len(scanned_hotspots) > OPTIONS.hotspots_noise:
|
if len(scanned_hotspots) > OPTIONS.hotspots_noise:
|
||||||
return
|
return
|
||||||
# calculate frequency for each hotspot and create list of valid hotspots
|
# calculate frequency for each hotspot and create list of valid hotspots
|
||||||
@ -325,6 +327,8 @@ def process_hotspots(scanned_hotspots):
|
|||||||
print(f'Channel {channel_index} allocated on frequency {channel_frequency} Hz')
|
print(f'Channel {channel_index} allocated on frequency {channel_frequency} Hz')
|
||||||
else:
|
else:
|
||||||
fc = hotspot['fc']
|
fc = hotspot['fc']
|
||||||
|
if fc not in UNSERVED_FREQUENCIES:
|
||||||
|
UNSERVED_FREQUENCIES.append(fc)
|
||||||
print(f'All channels allocated. Cannot process signal at {fc} Hz')
|
print(f'All channels allocated. Cannot process signal at {fc} Hz')
|
||||||
# cleanup
|
# cleanup
|
||||||
for channel in CONFIG['channel_info']:
|
for channel in CONFIG['channel_info']:
|
||||||
@ -333,6 +337,7 @@ def process_hotspots(scanned_hotspots):
|
|||||||
channel_index = channel['index']
|
channel_index = channel['index']
|
||||||
fc = channel['frequency']
|
fc = channel['frequency']
|
||||||
set_channel_mute(channel)
|
set_channel_mute(channel)
|
||||||
|
UNSERVED_FREQUENCIES.clear() # at least one channel is able to serve next time
|
||||||
print(f'Released channel {channel_index} on frequency {fc} Hz')
|
print(f'Released channel {channel_index} on frequency {fc} Hz')
|
||||||
elif channel['usage'] == 2: # channel used on this pass
|
elif channel['usage'] == 2: # channel used on this pass
|
||||||
channel['usage'] = 1 # reset usage for next pass
|
channel['usage'] = 1 # reset usage for next pass
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user