add antenna switching support for sdrplay

This commit is contained in:
Jakob Ketterl 2019-05-19 13:17:36 +02:00
parent a85a6c694c
commit eb758685a1
3 changed files with 12 additions and 13 deletions

View File

@ -133,7 +133,8 @@ sdrs = {
"rf_gain": 40,
"samp_rate": 500000,
"start_freq": 14070000,
"start_mod": "usb"
"start_mod": "usb",
"antenna": "Antenna A"
},
"40m": {
"name":"40m",
@ -141,7 +142,8 @@ sdrs = {
"rf_gain": 40,
"samp_rate": 500000,
"start_freq": 7070000,
"start_mod": "usb"
"start_mod": "usb",
"antenna": "Antenna A"
},
"80m": {
"name":"80m",
@ -149,7 +151,8 @@ sdrs = {
"rf_gain": 40,
"samp_rate": 500000,
"start_freq": 3570000,
"start_mod": "usb"
"start_mod": "usb",
"antenna": "Antenna A"
},
"49m": {
"name": "49m Broadcast",
@ -157,7 +160,8 @@ sdrs = {
"rf_gain": 40,
"samp_rate": 500000,
"start_freq": 6070000,
"start_mod": "am"
"start_mod": "am",
"antenna": "Antenna A"
}
}
},

View File

@ -32,7 +32,7 @@ class PropertyManager(object):
return PropertyManager.sharedInstance
def collect(self, *props):
return PropertyManager(dict((name, self.getProperty(name) if self.hasProperty(name) else Property()) for name in props))
return PropertyManager({name: self.getProperty(name) if self.hasProperty(name) else Property() for name in props})
def __init__(self, properties = None):
self.properties = {}

View File

@ -76,7 +76,7 @@ class SdrSource(object):
self.props = props
self.activateProfile()
self.rtlProps = self.props.collect(
"type", "samp_rate", "nmux_memory", "center_freq", "ppm", "rf_gain", "lna_gain", "rf_amp"
"samp_rate", "nmux_memory", "center_freq", "ppm", "rf_gain", "lna_gain", "rf_amp", "antenna"
).defaults(PropertyManager.getSharedInstance())
def restart(name, value):
@ -128,12 +128,7 @@ class SdrSource(object):
props = self.rtlProps
start_sdr_command = self.command.format(
samp_rate = props["samp_rate"],
center_freq = props["center_freq"],
ppm = props["ppm"],
rf_gain = props["rf_gain"],
lna_gain = props["lna_gain"],
rf_amp = props["rf_amp"]
**props.collect("samp_rate", "center_freq", "ppm", "rf_gain", "lna_gain", "rf_amp", "antenna").__dict__()
)
if self.format_conversion is not None:
@ -243,7 +238,7 @@ class HackrfSource(SdrSource):
class SdrplaySource(SdrSource):
def __init__(self, props, port):
super().__init__(props, port)
self.command = "rx_sdr -F CF32 -s {samp_rate} -f {center_freq} -p {ppm} -g {rf_gain} -"
self.command = "rx_sdr -F CF32 -s {samp_rate} -f {center_freq} -p {ppm} -g {rf_gain} -a \"{antenna}\" -"
self.format_conversion = None
def sleepOnRestart(self):