fix some exceptions due to None values

This commit is contained in:
Jakob Ketterl 2020-10-11 00:15:09 +02:00
parent a856c27fe4
commit f31685e4e7
2 changed files with 4 additions and 0 deletions

View File

@ -643,6 +643,8 @@ class dsp(object):
return self.samp_rate / self.fft_fps / self.fft_averages return self.samp_rate / self.fft_fps / self.fft_averages
def set_offset_freq(self, offset_freq): def set_offset_freq(self, offset_freq):
if offset_freq is None:
return
self.offset_freq = offset_freq self.offset_freq = offset_freq
if self.running: if self.running:
self.pipes["shift_pipe"].write("%g\n" % (-float(self.offset_freq) / self.samp_rate)) self.pipes["shift_pipe"].write("%g\n" % (-float(self.offset_freq) / self.samp_rate))

View File

@ -72,6 +72,8 @@ class DspManager(csdr.output, SdrSourceEventClient):
self.dsp.set_bpf(*bpf) self.dsp.set_bpf(*bpf)
def set_dial_freq(key, value): def set_dial_freq(key, value):
if self.props["center_freq"] is None or self.props["offset_freq"] is None:
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():
parser.setDialFrequency(freq) parser.setDialFrequency(freq)