fix secondary demod; add same-value handling
This commit is contained in:
parent
d5c2f8414e
commit
cc5c130f49
@ -41,13 +41,15 @@ class DspManager(csdr.output):
|
|||||||
"temporary_directory",
|
"temporary_directory",
|
||||||
"center_freq",
|
"center_freq",
|
||||||
|
|
||||||
# TODO: following properties are set from the client
|
# TODO: following properties are set from the client; check if it's really necessary to have the Properties
|
||||||
"output_rate",
|
"output_rate",
|
||||||
"squelch_level",
|
"squelch_level",
|
||||||
"secondary_mod",
|
"secondary_mod",
|
||||||
"low_cut",
|
"low_cut",
|
||||||
"high_cut",
|
"high_cut",
|
||||||
"offset_freq",
|
"offset_freq",
|
||||||
|
"mod",
|
||||||
|
"secondary_offset_freq",
|
||||||
)
|
)
|
||||||
|
|
||||||
self.dsp = csdr.dsp(self)
|
self.dsp = csdr.dsp(self)
|
||||||
@ -107,8 +109,8 @@ class DspManager(csdr.output):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.subscriptions += [
|
self.subscriptions += [
|
||||||
self.localProps.collect("secondary_mod").wire(set_secondary_mod),
|
self.localProps.wireProperty("secondary_mod", set_secondary_mod),
|
||||||
self.localProps.collect("secondary_offset_freq").wire(self.dsp.set_secondary_offset_freq),
|
self.localProps.wireProperty("secondary_offset_freq", self.dsp.set_secondary_offset_freq),
|
||||||
]
|
]
|
||||||
|
|
||||||
self.sdrSource.addClient(self)
|
self.sdrSource.addClient(self)
|
||||||
|
@ -94,6 +94,8 @@ class PropertyLayer(PropertyManager):
|
|||||||
return self.properties[name]
|
return self.properties[name]
|
||||||
|
|
||||||
def __setitem__(self, name, value):
|
def __setitem__(self, name, value):
|
||||||
|
if name in self.properties and self.properties[name] == value:
|
||||||
|
return
|
||||||
logger.debug("property change: %s => %s", name, value)
|
logger.debug("property change: %s => %s", name, value)
|
||||||
self.properties[name] = value
|
self.properties[name] = value
|
||||||
self._fireCallbacks(name, value)
|
self._fireCallbacks(name, value)
|
||||||
|
@ -50,3 +50,11 @@ class PropertyLayerTest(TestCase):
|
|||||||
mock.method.assert_not_called()
|
mock.method.assert_not_called()
|
||||||
pm["testkey"] = "newvalue"
|
pm["testkey"] = "newvalue"
|
||||||
mock.method.assert_called_once_with("newvalue")
|
mock.method.assert_called_once_with("newvalue")
|
||||||
|
|
||||||
|
def testEventPreventedWhenValueUnchanged(self):
|
||||||
|
pm = PropertyLayer()
|
||||||
|
pm["testkey"] = "testvalue"
|
||||||
|
mock = Mock()
|
||||||
|
pm.wire(mock.method)
|
||||||
|
pm["testkey"] = "testvalue"
|
||||||
|
mock.method.assert_not_called()
|
||||||
|
Loading…
Reference in New Issue
Block a user