From fa338a1b349c0e5cae93a2c5ba4bb7a4d83b1287 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sat, 19 Nov 2022 12:38:56 +0100 Subject: [PATCH] qo100_datv.py: use device dependent key for log2 decimation --- scriptsapi/qo100_datv.py | 49 ++++++++++++++++++++++++---------------- scriptsapi/sdrangel.py | 8 +++++++ 2 files changed, 37 insertions(+), 20 deletions(-) diff --git a/scriptsapi/qo100_datv.py b/scriptsapi/qo100_datv.py index c938dd105..58321dcf2 100755 --- a/scriptsapi/qo100_datv.py +++ b/scriptsapi/qo100_datv.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +# pylint: disable=line-too-long """ Quick control of configuration for receiving QO-100 DATV """ @@ -42,32 +43,42 @@ def get_input_options(): class Controller: """ Controller main class """ def __init__(self): - self.device_hwid = None + self.device_hwtype = None # ====================================================================== - def change_center_frequency(self, content, new_frequency): - """ Change center frequency searching recursively """ + def change_device_center_frequency(self, content, new_frequency): + """ Change device center frequency searching recursively """ # ---------------------------------------------------------------------- for k in content: if isinstance(content[k], dict): - self.change_center_frequency(content[k], new_frequency) - elif k == "centerFrequency": + self.change_device_center_frequency(content[k], new_frequency) + elif k == sdrangel.DEVICE_TYPES[self.device_hwtype]["cf_key"]: content[k] = new_frequency # ====================================================================== def change_decim(self, content, new_decim): - """ Change log2 decimation searching recursively """ + """ Change device log2 decimation searching recursively """ # ---------------------------------------------------------------------- for k in content: if isinstance(content[k], dict): self.change_decim(content[k], new_decim) - elif k == "log2Decim": + elif k == sdrangel.DEVICE_TYPES[self.device_hwtype]["decim_key"]: content[k] = new_decim + # ====================================================================== + def change_channel_center_frequency(self, content, new_frequency): + """ Change DATV channel center frequency searching recursively """ + # ---------------------------------------------------------------------- + for k in content: + if isinstance(content[k], dict): + self.change_channel_center_frequency(content[k], new_frequency) + elif k == "centerFrequency": + content[k] = new_frequency + # ====================================================================== def change_rfbw(self, content, new_rfbw): - """ Change RF bandwidth searching recursively """ + """ Change DATV channel RF bandwidth searching recursively """ # ---------------------------------------------------------------------- for k in content: if isinstance(content[k], dict): @@ -77,7 +88,7 @@ class Controller: # ====================================================================== def change_symbol_rate(self, content, new_symbol_rate): - """ Change symbol rate searching recursively """ + """ Change DATV channel symbol rate searching recursively """ # ---------------------------------------------------------------------- for k in content: if isinstance(content[k], dict): @@ -89,16 +100,17 @@ class Controller: def get_device_sr_and_decim(self, hwtype, settings): """ Return device sample rate and decimation """ # ---------------------------------------------------------------------- - if hwtype == "Airspy" or hwtype == "AirspyHF": + decim_key = sdrangel.DEVICE_TYPES[self.device_hwtype]["decim_key"] + if hwtype in ("Airspy", "AirspyHF"): sr_index = settings.get("devSampleRateIndex", 0) if sr_index == 1: sr = 3000000 else: sr = 6000000 - log2_decim = settings.get("log2Decim", 0) + log2_decim = settings.get(decim_key, 0) else: sr = settings.get("devSampleRate", 0) - log2_decim = settings.get("log2Decim", 0) + log2_decim = settings.get(decim_key, 0) return sr, 1<