prevent KeyError by checking for key existence
This commit is contained in:
parent
f4b9decd23
commit
341b94b9ff
21
owrx/dsp.py
21
owrx/dsp.py
@ -28,7 +28,9 @@ class DspManager(csdr.output, SdrSourceEventClient):
|
|||||||
|
|
||||||
self.props = PropertyStack()
|
self.props = PropertyStack()
|
||||||
# local demodulator properties not forwarded to the sdr
|
# local demodulator properties not forwarded to the sdr
|
||||||
self.props.addLayer(0, PropertyLayer().filter(
|
self.props.addLayer(
|
||||||
|
0,
|
||||||
|
PropertyLayer().filter(
|
||||||
"output_rate",
|
"output_rate",
|
||||||
"hd_output_rate",
|
"hd_output_rate",
|
||||||
"squelch_level",
|
"squelch_level",
|
||||||
@ -39,9 +41,12 @@ class DspManager(csdr.output, SdrSourceEventClient):
|
|||||||
"mod",
|
"mod",
|
||||||
"secondary_offset_freq",
|
"secondary_offset_freq",
|
||||||
"dmr_filter",
|
"dmr_filter",
|
||||||
))
|
),
|
||||||
|
)
|
||||||
# properties that we inherit from the sdr
|
# properties that we inherit from the sdr
|
||||||
self.props.addLayer(1, self.sdrSource.getProps().filter(
|
self.props.addLayer(
|
||||||
|
1,
|
||||||
|
self.sdrSource.getProps().filter(
|
||||||
"audio_compression",
|
"audio_compression",
|
||||||
"fft_compression",
|
"fft_compression",
|
||||||
"digimodes_fft_size",
|
"digimodes_fft_size",
|
||||||
@ -56,7 +61,8 @@ class DspManager(csdr.output, SdrSourceEventClient):
|
|||||||
"start_mod",
|
"start_mod",
|
||||||
"start_freq",
|
"start_freq",
|
||||||
"wfm_deemphasis_tau",
|
"wfm_deemphasis_tau",
|
||||||
))
|
),
|
||||||
|
)
|
||||||
|
|
||||||
self.dsp = csdr.dsp(self)
|
self.dsp = csdr.dsp(self)
|
||||||
self.dsp.nc_port = self.sdrSource.getPort()
|
self.dsp.nc_port = self.sdrSource.getPort()
|
||||||
@ -72,7 +78,12 @@ class DspManager(csdr.output, SdrSourceEventClient):
|
|||||||
self.dsp.set_bpf(*bpf)
|
self.dsp.set_bpf(*bpf)
|
||||||
|
|
||||||
def set_dial_freq(changes):
|
def set_dial_freq(changes):
|
||||||
if self.props["center_freq"] is None or self.props["offset_freq"] is None:
|
if (
|
||||||
|
"center_freq" not in self.props
|
||||||
|
or self.props["center_freq"] is None
|
||||||
|
or "offset_freq" not in self.props
|
||||||
|
or self.props["offset_freq"] is None
|
||||||
|
):
|
||||||
return
|
return
|
||||||
freq = self.props["center_freq"] + self.props["offset_freq"]
|
freq = self.props["center_freq"] + self.props["offset_freq"]
|
||||||
for parser in self.parsers.values():
|
for parser in self.parsers.values():
|
||||||
|
Loading…
Reference in New Issue
Block a user