From 11ec294032f8ee0f1b40417728b770eb39ec5438 Mon Sep 17 00:00:00 2001 From: Marat Fayzullin Date: Wed, 14 Sep 2022 22:59:27 -0400 Subject: [PATCH] Adding new gain options available in SoapySDRPlay3. --- owrx/source/sdrplay.py | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/owrx/source/sdrplay.py b/owrx/source/sdrplay.py index 454e472..0395c47 100644 --- a/owrx/source/sdrplay.py +++ b/owrx/source/sdrplay.py @@ -1,5 +1,6 @@ from owrx.source.soapy import SoapyConnectorSource, SoapyConnectorDeviceDescription -from owrx.form.input import Input, CheckboxInput, DropdownInput, DropdownEnum +from owrx.form.input import Input, CheckboxInput, DropdownInput, NumberInput, DropdownEnum +from owrx.form.input.validator import RangeValidator from owrx.form.input.device import BiasTeeInput from typing import List @@ -14,6 +15,9 @@ class SdrplaySource(SoapyConnectorSource): "dab_notch": "dabnotch_ctrl", "if_mode": "if_mode", "external_reference": "extref_ctrl", + "gain_ctrl_mode": "gain_ctrl_mode", + "agc_setpoint": "agc_setpoint", + "rfgain_sel": "rfgain_sel" } ) return mappings @@ -32,6 +36,16 @@ class IfModeOptions(DropdownEnum): return self.value +class GainModelOptions(DropdownEnum): + GMODEL_LEGACY = "LEGACY" + GMODEL_DB = "DB" + GMODEL_RFATT = "RFATT" + GMODEL_STEPS = "STEPS" + + def __str__(self): + return self.value + + class SdrplayDeviceDescription(SoapyConnectorDeviceDescription): def getName(self): return "SDRPlay device (RSP1, RSP2, RSPDuo, RSPDx)" @@ -55,10 +69,26 @@ class SdrplayDeviceDescription(SoapyConnectorDeviceDescription): "IF Mode", IfModeOptions, ), + DropdownInput( + "gain_ctrl_model", + "Gain Control Model", + GainModelOptions, + ), + NumberInput( + "agc_setpoint", + "AGC Setpoint", + append="dBFS", + validator=RangeValidator(-60, 0), + ), + NumberInput( + "rfgain_sel", + "RF Gain Reduction", + validator=RangeValidator(0, 32), + ), ] def getDeviceOptionalKeys(self): - return super().getDeviceOptionalKeys() + ["bias_tee", "rf_notch", "dab_notch", "if_mode"] + return super().getDeviceOptionalKeys() + ["bias_tee", "rf_notch", "dab_notch", "if_mode", "gain_ctrl_mode", "agc_setpoint", "rfgain_sel"] def getProfileOptionalKeys(self): - return super().getProfileOptionalKeys() + ["bias_tee", "rf_notch", "dab_notch", "if_mode"] + return super().getProfileOptionalKeys() + ["bias_tee", "rf_notch", "dab_notch", "if_mode", "gain_ctrl_mode", "agc_setpoint", "rfgain_sel"]