Picking latest changes from the main OWRX repo.
This commit is contained in:
parent
74cace883c
commit
dd908c0917
25
owrx/dsp.py
25
owrx/dsp.py
|
|
@ -679,19 +679,20 @@ class DspManager(SdrSourceEventClient, ClientDemodulatorSecondaryDspEventClient)
|
|||
def unpickler(data):
|
||||
b = data.tobytes()
|
||||
# If we know it's not pickled, let us not unpickle
|
||||
if len(b)<2 or b[0]!=0x80 or b[1]<0x03:
|
||||
if len(b) < 2 or b[0] != 0x80 or not 3 <= b[1] <= pickle.HIGHEST_PROTOCOL:
|
||||
callback(b.decode("ascii"))
|
||||
else:
|
||||
io = BytesIO(b)
|
||||
try:
|
||||
while True:
|
||||
callback(pickle.load(io))
|
||||
except EOFError:
|
||||
pass
|
||||
except pickle.UnpicklingError:
|
||||
callback(b.decode("ascii"))
|
||||
except ValueError:
|
||||
pass
|
||||
return
|
||||
|
||||
io = BytesIO(b)
|
||||
try:
|
||||
while True:
|
||||
callback(pickle.load(io))
|
||||
except EOFError:
|
||||
pass
|
||||
except pickle.UnpicklingError:
|
||||
callback(b.decode("ascii"))
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
return unpickler
|
||||
|
||||
|
|
|
|||
|
|
@ -174,11 +174,17 @@ class ServiceHandler(SdrSourceEventClient):
|
|||
addService(dial, self.source)
|
||||
|
||||
def get_min_max(self, group):
|
||||
def find_bandpass(dial):
|
||||
mode = Modes.findByModulation(dial["mode"])
|
||||
if "underlying" in dial:
|
||||
mode = mode.for_underlying(dial["underlying"])
|
||||
return mode.get_bandpass()
|
||||
|
||||
frequencies = sorted(group, key=lambda f: f["frequency"])
|
||||
lowest = frequencies[0]
|
||||
min = lowest["frequency"] + Modes.findByModulation(lowest["mode"]).get_bandpass().low_cut
|
||||
min = lowest["frequency"] + find_bandpass(lowest).low_cut
|
||||
highest = frequencies[-1]
|
||||
max = highest["frequency"] + Modes.findByModulation(highest["mode"]).get_bandpass().high_cut
|
||||
max = highest["frequency"] + find_bandpass(highest).high_cut
|
||||
return min, max
|
||||
|
||||
def get_center_frequency(self, group):
|
||||
|
|
|
|||
Loading…
Reference in New Issue