From 35ad4712bbf5ec4b413e5ac370f262a243c152cf Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Thu, 9 Jun 2022 20:25:29 +0200 Subject: [PATCH] disable PPM input for devices that don't support it --- owrx/source/__init__.py | 14 ++++++++++++-- owrx/source/airspy.py | 6 ++++++ owrx/source/airspyhf.py | 4 ++++ owrx/source/fifi_sdr.py | 4 ++++ owrx/source/hackrf.py | 5 +++++ owrx/source/perseussdr.py | 4 ++++ owrx/source/runds.py | 4 ++++ 7 files changed, 39 insertions(+), 2 deletions(-) diff --git a/owrx/source/__init__.py b/owrx/source/__init__.py index 8ebd910..ae790be 100644 --- a/owrx/source/__init__.py +++ b/owrx/source/__init__.py @@ -514,6 +514,14 @@ class SdrDeviceDescription(object): """ return None + def supportsPpm(self): + """ + can be overridden if the device does not support configuring PPM correction + + :return: bool + """ + return True + def getDeviceInputs(self) -> List[Input]: keys = self.getDeviceMandatoryKeys() + self.getDeviceOptionalKeys() return [TextInput("name", "Device name", validator=RequiredValidator())] + [ @@ -568,8 +576,7 @@ class SdrDeviceDescription(object): return ["name", "enabled"] def getDeviceOptionalKeys(self): - return [ - "ppm", + keys = [ "always-on", "services", "rf_gain", @@ -577,6 +584,9 @@ class SdrDeviceDescription(object): "waterfall_levels", "scheduler", ] + if self.supportsPpm(): + keys += ["ppm"] + return keys def getProfileMandatoryKeys(self): return ["name", "center_freq", "samp_rate", "start_freq", "start_mod"] diff --git a/owrx/source/airspy.py b/owrx/source/airspy.py index 53e7f13..e851ab3 100644 --- a/owrx/source/airspy.py +++ b/owrx/source/airspy.py @@ -23,6 +23,12 @@ class AirspyDeviceDescription(SoapyConnectorDeviceDescription): def getName(self): return "Airspy R2 or Mini" + def supportsPpm(self): + # not supported by the device API + # frequency calibration can be done with separate tools and will be persisted on the device. + # see discussion here: https://groups.io/g/openwebrx/topic/79360293 + return False + def getInputs(self) -> List[Input]: return super().getInputs() + [ BiasTeeInput(), diff --git a/owrx/source/airspyhf.py b/owrx/source/airspyhf.py index 82cc03b..c7399a6 100644 --- a/owrx/source/airspyhf.py +++ b/owrx/source/airspyhf.py @@ -9,3 +9,7 @@ class AirspyhfSource(SoapyConnectorSource): class AirspyhfDeviceDescription(SoapyConnectorDeviceDescription): def getName(self): return "Airspy HF+ or Discovery" + + def supportsPpm(self): + # not currently supported by the SoapySDR module. + return False diff --git a/owrx/source/fifi_sdr.py b/owrx/source/fifi_sdr.py index 4bf3bdd..660c65f 100644 --- a/owrx/source/fifi_sdr.py +++ b/owrx/source/fifi_sdr.py @@ -45,3 +45,7 @@ class FifiSdrSource(DirectSource): class FifiSdrDeviceDescription(DirectSourceDeviceDescription): def getName(self): return "FiFi SDR" + + def supportsPpm(self): + # not currently mapped, and it's unclear how this should be sent to the device + return False diff --git a/owrx/source/hackrf.py b/owrx/source/hackrf.py index bd16a3d..56ef27b 100644 --- a/owrx/source/hackrf.py +++ b/owrx/source/hackrf.py @@ -18,6 +18,11 @@ class HackrfDeviceDescription(SoapyConnectorDeviceDescription): def getName(self): return "HackRF" + def supportsPpm(self): + # not implemented by the SoapySDR module. + # see discussion here: https://groups.io/g/openwebrx/topic/78339109 + return False + def getInputs(self) -> List[Input]: return super().getInputs() + [BiasTeeInput()] diff --git a/owrx/source/perseussdr.py b/owrx/source/perseussdr.py index ff5b0c5..74ed1ca 100644 --- a/owrx/source/perseussdr.py +++ b/owrx/source/perseussdr.py @@ -53,6 +53,10 @@ class PerseussdrDeviceDescription(DirectSourceDeviceDescription): def getName(self): return "Perseus SDR" + def supportsPpm(self): + # not currently mapped, and not available as an option to "perseustest" + return False + def getInputs(self) -> List[Input]: return super().getInputs() + [ DropdownInput("attenuator", "Attenuator", options=AttenuatorOptions), diff --git a/owrx/source/runds.py b/owrx/source/runds.py index 9d4e9b9..0f4a467 100644 --- a/owrx/source/runds.py +++ b/owrx/source/runds.py @@ -40,6 +40,10 @@ class RundsDeviceDescription(ConnectorDeviceDescription): def getName(self): return "R&S device using EB200 or Ammos protocol" + def supportsPpm(self): + # currently not implemented in the connector + return False + def getInputs(self) -> List[Input]: return super().getInputs() + [ RemoteInput(),