diff --git a/routes/listening_post.py b/routes/listening_post.py index ba7d2b3..defcb34 100644 --- a/routes/listening_post.py +++ b/routes/listening_post.py @@ -301,16 +301,34 @@ def scanner_loop(): current_freq = scanner_config['start_freq'] continue - # Stay on this frequency (dwell) but check periodically - dwell_start = time.time() - while (time.time() - dwell_start) < scanner_config['dwell_time'] and scanner_running: - if scanner_skip_signal: - break - time.sleep(0.2) - - last_signal_time = time.time() - - else: + # Stay on this frequency (dwell) but check periodically + dwell_start = time.time() + while (time.time() - dwell_start) < scanner_config['dwell_time'] and scanner_running: + if scanner_skip_signal: + break + time.sleep(0.2) + + last_signal_time = time.time() + + # After dwell, move on to keep scanning + if scanner_running and not scanner_skip_signal: + signal_detected = False + _stop_audio_stream() + try: + scanner_queue.put_nowait({ + 'type': 'signal_lost', + 'frequency': current_freq + }) + except queue.Full: + pass + + current_freq += step_mhz + if current_freq > scanner_config['end_freq']: + current_freq = scanner_config['start_freq'] + add_activity_log('scan_cycle', current_freq, 'Scan cycle complete') + time.sleep(scanner_config['scan_delay']) + + else: # No signal at this frequency if signal_detected: # Signal lost