fix offset switching
This commit is contained in:
parent
de51e266f6
commit
dab62a04df
@ -192,7 +192,7 @@ class SdrSource(object):
|
|||||||
|
|
||||||
def getCommandValues(self):
|
def getCommandValues(self):
|
||||||
dict = self.rtlProps.collect(*self.getEventNames()).__dict__()
|
dict = self.rtlProps.collect(*self.getEventNames()).__dict__()
|
||||||
if "lfo_offset" in dict:
|
if "lfo_offset" in dict and dict["lfo_offset"] is not None:
|
||||||
dict["tuner_freq"] = dict["center_freq"] + dict["lfo_offset"]
|
dict["tuner_freq"] = dict["center_freq"] + dict["lfo_offset"]
|
||||||
else:
|
else:
|
||||||
dict["tuner_freq"] = dict["center_freq"]
|
dict["tuner_freq"] = dict["center_freq"]
|
||||||
@ -451,16 +451,19 @@ class ConnectorSource(SdrSource):
|
|||||||
self.controlSocket = None
|
self.controlSocket = None
|
||||||
self.controlPort = getAvailablePort()
|
self.controlPort = getAvailablePort()
|
||||||
|
|
||||||
|
def sendControlMessage(self, prop, value):
|
||||||
|
logger.debug("sending property change over control socket: {0} changed to {1}".format(prop, value))
|
||||||
|
self.controlSocket.sendall("{prop}:{value}\n".format(prop=prop, value=value).encode())
|
||||||
|
|
||||||
def wireEvents(self):
|
def wireEvents(self):
|
||||||
def reconfigure(prop, value):
|
def reconfigure(prop, value):
|
||||||
if self.monitor is None:
|
if self.monitor is None:
|
||||||
return
|
return
|
||||||
v = value
|
if (prop == "center_freq" or prop == "lfo_offset") and "lfo_offset" in self.rtlProps:
|
||||||
if prop == "center_freq" and "lfo_offset" in self.rtlProps:
|
freq = self.rtlProps["center_freq"] + self.rtlProps["lfo_offset"]
|
||||||
v = value + self.rtlProps["lfo_offset"]
|
self.sendControlMessage("center_freq", freq)
|
||||||
logger.debug("sending property change over control socket: {0} changed to {1}".format(prop, v))
|
else:
|
||||||
self.controlSocket.sendall("{prop}:{value}\n".format(prop=prop, value=v).encode())
|
self.sendControlMessage(prop, value)
|
||||||
|
|
||||||
self.rtlProps.wire(reconfigure)
|
self.rtlProps.wire(reconfigure)
|
||||||
|
|
||||||
def postStart(self):
|
def postStart(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user