diff --git a/auto_rx/autorx/__init__.py b/auto_rx/autorx/__init__.py index bedab01e..27ff82bd 100644 --- a/auto_rx/autorx/__init__.py +++ b/auto_rx/autorx/__init__.py @@ -12,7 +12,7 @@ # MINOR - New sonde type support, other fairly big changes that may result in telemetry or config file incompatability issus. # PATCH - Small changes, or minor feature additions. -__version__ = "1.8.0-beta1" +__version__ = "1.8.0-beta2" # Global Variables diff --git a/auto_rx/autorx/ka9q.py b/auto_rx/autorx/ka9q.py index 97eabec4..4c4aa466 100644 --- a/auto_rx/autorx/ka9q.py +++ b/auto_rx/autorx/ka9q.py @@ -16,17 +16,23 @@ def ka9q_setup_channel( sdr_hostname, frequency, - sample_rate + sample_rate, + scan ): + if scan: + ssrc="04" + else: + ssrc="01" + # tune --samprate 48000 --frequency 404m09 --mode iq --ssrc 404090000 --radio sonde.local _cmd = ( f"{timeout_cmd()} 5 " # Add a timeout, because connections to non-existing servers block for ages f"tune " f"--samprate {int(sample_rate)} " f"--mode iq " - f"--low {int(sample_rate) / (-2.4)} --high {int(sample_rate) / 2.4} " + f"--low {int(int(sample_rate) / (-2.4))} --high {int(int(sample_rate) / 2.4)} " f"--frequency {int(frequency)} " - f"--ssrc {round(frequency / 1000)}01 " + f"--ssrc {round(frequency / 1000)}{ssrc} " f"--radio {sdr_hostname}" ) @@ -62,8 +68,13 @@ def ka9q_setup_channel( def ka9q_close_channel( sdr_hostname, - frequency + frequency, + scan ): + if scan: + ssrc="04" + else: + ssrc="01" _cmd = ( f"{timeout_cmd()} 5 " # Add a timeout, because connections to non-existing servers block for ages @@ -71,7 +82,7 @@ def ka9q_close_channel( f"--samprate 48000 " f"--mode iq " f"--frequency 0 " - f"--ssrc {round(frequency / 1000)}01 " + f"--ssrc {round(frequency / 1000)}{ssrc} " f"--radio {sdr_hostname}" ) @@ -108,11 +119,16 @@ def ka9q_close_channel( def ka9q_get_iq_cmd( sdr_hostname, frequency, - sample_rate + sample_rate, + scan ): + if scan: + ssrc="04" + else: + ssrc="01" # We need to setup a channel before we can use it! - _setup_success = ka9q_setup_channel(sdr_hostname, frequency, sample_rate) + _setup_success = ka9q_setup_channel(sdr_hostname, frequency, sample_rate, scan) if not _setup_success: logging.critical(f"KA9Q ({sdr_hostname}) - Could not setup rx channel! Decoder will likely timeout.") @@ -124,7 +140,7 @@ def ka9q_get_iq_cmd( # -2 option was removed sometime in early 2024. _cmd = ( f"pcmcat " - f"-s {round(frequency / 1000)}01 " + f"-s {round(frequency / 1000)}{ssrc} " f"{_pcm_host} |" ) diff --git a/auto_rx/autorx/scan.py b/auto_rx/autorx/scan.py index 6449e776..9add39e6 100644 --- a/auto_rx/autorx/scan.py +++ b/auto_rx/autorx/scan.py @@ -330,7 +330,8 @@ def detect_sonde( bias = bias, sdr_hostname = sdr_hostname, sdr_port = sdr_port, - ss_iq_path = ss_iq_path + ss_iq_path = ss_iq_path, + scan = True ) # rx_test_command = ( @@ -436,7 +437,7 @@ def detect_sonde( ret_output = ret_output.decode("utf8") # Release the SDR channel if necessary - shutdown_sdr(sdr_type, rtl_device_idx, sdr_hostname, frequency) + shutdown_sdr(sdr_type, rtl_device_idx, sdr_hostname, frequency, scan=True) except subprocess.CalledProcessError as e: # dft_detect returns a code of 1 if no sonde is detected. diff --git a/auto_rx/autorx/sdr_wrappers.py b/auto_rx/autorx/sdr_wrappers.py index ed27f09b..b598fd91 100644 --- a/auto_rx/autorx/sdr_wrappers.py +++ b/auto_rx/autorx/sdr_wrappers.py @@ -245,7 +245,8 @@ def shutdown_sdr( sdr_type: str, sdr_id: str, sdr_hostname = "", - frequency: int = None + frequency: int = None, + scan: bool = False, ): """ Function to trigger shutdown/cleanup of some SDR types. @@ -257,7 +258,7 @@ def shutdown_sdr( if sdr_type == "KA9Q": logging.debug(f"KA9Q - Closing Channel for {sdr_hostname} @ {frequency} Hz.") - ka9q_close_channel(sdr_hostname, frequency) + ka9q_close_channel(sdr_hostname, frequency, scan) pass else: logging.debug(f"No shutdown action required for SDR type {sdr_type}") @@ -279,7 +280,8 @@ def get_sdr_iq_cmd( bias = False, sdr_hostname = "", sdr_port = 5555, - ss_iq_path = "./ss_iq" + ss_iq_path = "./ss_iq", + scan = False ): """ Get a command-line argument to get IQ (signed 16-bit) from a SDR @@ -301,6 +303,7 @@ def get_sdr_iq_cmd( Arguments for KA9Q SDR Server / SpyServer: sdr_hostname (str): Hostname of KA9Q Server sdr_port (int): Port number of KA9Q Server + scan (bool): Create unique SSRC for scan attempts Arguments for SpyServer Client: ss_iq_path (str): Path to spyserver IQ client utility. @@ -358,7 +361,7 @@ def get_sdr_iq_cmd( return _cmd if sdr_type == "KA9Q": - _cmd = ka9q_get_iq_cmd(sdr_hostname, frequency, sample_rate) + _cmd = ka9q_get_iq_cmd(sdr_hostname, frequency, sample_rate, scan) if dc_block: _cmd += _dc_remove