mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-12-16 07:53:26 -05:00
Superscanner: optimization: do not move channel to same frequency
This commit is contained in:
parent
38dcac2b46
commit
e06704532d
@ -316,9 +316,13 @@ def process_hotspots(scanned_hotspots):
|
|||||||
channel = distance[1]
|
channel = distance[1]
|
||||||
hotspot = distance[2]
|
hotspot = distance[2]
|
||||||
if hotspot in hotspots: # hotspot is not processed yet
|
if hotspot in hotspots: # hotspot is not processed yet
|
||||||
|
channel_frequency = get_hotspot_frequency(channel, hotspot)
|
||||||
channel['usage'] = 2 # mark channel used on this pass
|
channel['usage'] = 2 # mark channel used on this pass
|
||||||
channel['frequency'] = get_hotspot_frequency(channel, hotspot)
|
if channel['frequency'] != channel_frequency: # optimization: do not move to same frequency
|
||||||
set_channel_frequency(channel)
|
channel['frequency'] = channel_frequency
|
||||||
|
channel_index = channel['index']
|
||||||
|
set_channel_frequency(channel)
|
||||||
|
log_with_timestamp(f'Moved channel {channel_index} to frequency {channel_frequency} Hz')
|
||||||
hotspots.remove(hotspot) # done with this hotspot
|
hotspots.remove(hotspot) # done with this hotspot
|
||||||
# for remaining hotspots we need to allocate new channels
|
# for remaining hotspots we need to allocate new channels
|
||||||
for hotspot in hotspots:
|
for hotspot in hotspots:
|
||||||
@ -329,7 +333,7 @@ def process_hotspots(scanned_hotspots):
|
|||||||
channel['usage'] = 2 # mark channel used on this pass
|
channel['usage'] = 2 # mark channel used on this pass
|
||||||
channel['frequency'] = channel_frequency
|
channel['frequency'] = channel_frequency
|
||||||
set_channel_frequency(channel)
|
set_channel_frequency(channel)
|
||||||
log_with_timestamp(f'Channel {channel_index} allocated on frequency {channel_frequency} Hz')
|
log_with_timestamp(f'Allocated channel {channel_index} on frequency {channel_frequency} Hz')
|
||||||
else:
|
else:
|
||||||
fc = hotspot['fc']
|
fc = hotspot['fc']
|
||||||
if fc not in UNSERVED_FREQUENCIES:
|
if fc not in UNSERVED_FREQUENCIES:
|
||||||
@ -343,7 +347,7 @@ def process_hotspots(scanned_hotspots):
|
|||||||
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
|
UNSERVED_FREQUENCIES.clear() # at least one channel is able to serve next time
|
||||||
log_with_timestamp(f'Released channel {channel_index} on frequency {fc} Hz')
|
log_with_timestamp(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