From 8091831b1f1a3400da1241a720fe3f646fb79b9e Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sun, 19 May 2019 22:10:11 +0200 Subject: [PATCH] make both gains available for sdrplay --- config_webrx.py | 12 ++++++++---- owrx/connection.py | 2 +- owrx/source.py | 10 +++++++--- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/config_webrx.py b/config_webrx.py index d16b948..25053eb 100644 --- a/config_webrx.py +++ b/config_webrx.py @@ -130,7 +130,8 @@ sdrs = { "20m": { "name":"20m", "center_freq": 14150000, - "rf_gain": 40, + "rf_gain": 4, + "if_gain": 40, "samp_rate": 500000, "start_freq": 14070000, "start_mod": "usb", @@ -139,7 +140,8 @@ sdrs = { "40m": { "name":"40m", "center_freq": 7100000, - "rf_gain": 40, + "rf_gain": 4, + "if_gain": 40, "samp_rate": 500000, "start_freq": 7070000, "start_mod": "usb", @@ -148,7 +150,8 @@ sdrs = { "80m": { "name":"80m", "center_freq": 3650000, - "rf_gain": 40, + "rf_gain": 4, + "if_gain": 40, "samp_rate": 500000, "start_freq": 3570000, "start_mod": "usb", @@ -157,7 +160,8 @@ sdrs = { "49m": { "name": "49m Broadcast", "center_freq": 6000000, - "rf_gain": 40, + "rf_gain": 4, + "if_gain": 40, "samp_rate": 500000, "start_freq": 6070000, "start_mod": "am", diff --git a/owrx/connection.py b/owrx/connection.py index 95ce84f..029b8d4 100644 --- a/owrx/connection.py +++ b/owrx/connection.py @@ -81,7 +81,7 @@ class OpenWebRxClient(object): def setParams(self, params): # only the keys in the protected property manager can be overridden from the web - protected = self.sdr.getProps().collect("samp_rate", "center_freq", "rf_gain", "type") \ + protected = self.sdr.getProps().collect("samp_rate", "center_freq", "rf_gain", "type", "if_gain") \ .defaults(PropertyManager.getSharedInstance()) for key, value in params.items(): protected[key] = value diff --git a/owrx/source.py b/owrx/source.py index f5a0f5f..2820abc 100644 --- a/owrx/source.py +++ b/owrx/source.py @@ -76,7 +76,7 @@ class SdrSource(object): self.props = props self.activateProfile() self.rtlProps = self.props.collect( - "samp_rate", "nmux_memory", "center_freq", "ppm", "rf_gain", "lna_gain", "rf_amp", "antenna" + "samp_rate", "nmux_memory", "center_freq", "ppm", "rf_gain", "lna_gain", "rf_amp", "antenna", "if_gain" ).defaults(PropertyManager.getSharedInstance()) def restart(name, value): @@ -132,7 +132,7 @@ class SdrSource(object): props = self.rtlProps start_sdr_command = self.getCommand().format( - **props.collect("samp_rate", "center_freq", "ppm", "rf_gain", "lna_gain", "rf_amp", "antenna").__dict__() + **props.collect("samp_rate", "center_freq", "ppm", "rf_gain", "lna_gain", "rf_amp", "antenna", "if_gain").__dict__() ) format_conversion = self.getFormatConversion() @@ -244,7 +244,11 @@ class HackrfSource(SdrSource): class SdrplaySource(SdrSource): def getCommand(self): - command = "rx_sdr -F CF32 -s {samp_rate} -f {center_freq} -p {ppm} -g {rf_gain}" + command = "rx_sdr -F CF32 -s {samp_rate} -f {center_freq} -p {ppm}" + gainMap = { "rf_gain" : "RFGR", "if_gain" : "IFGR"} + gains = [ "{0}={{{1}}}".format(gainMap[name], name) for name in self.rtlProps.collect("rf_gain", "if_gain").__dict__() ] + if gains: + command += " -g {gains}".format(gains = ",".join(gains)) if self.rtlProps["antenna"] is not None: command += " -a \"{antenna}\"" command += " -"