diff --git a/decode_os433.py b/decode_os433.py index c88ee1b..3a10e3f 100755 --- a/decode_os433.py +++ b/decode_os433.py @@ -41,7 +41,7 @@ def __init__(self, center_freq, offset_freq, decimate_am=1, play_audio=False): self.osmosdr_source = osmosdr.source_c("") self.osmosdr_source.set_center_freq(freq) - self.osmosdr_source.set_samp_rate(device_rate) + self.osmosdr_source.set_sample_rate(device_rate) taps = firdes.low_pass(1, device_rate, 40000, 5000, firdes.WIN_HAMMING, 6.76) self.freq_filter = gr.freq_xlating_fir_filter_ccc(25, taps, -freq_offs, device_rate) @@ -92,8 +92,7 @@ def decode_osv1(stream, level=-0.35): for direction, time, abstime in transition(stream, level): # convert the time in samples to microseconds - time = time / float(stream.rate) * 1e6 - + time = time / float(stream.rate) * 1e6 if state == 'wait' and direction is True: # Start of the preamble state = 'preamble' @@ -108,7 +107,7 @@ def decode_osv1(stream, level=-0.35): else: state = 'wait' else: - if (700 < time < 1400): + if (700 < time < 1500): # Valid rising edge in preamble pass elif count>8 and (2700 < time < 5000): @@ -157,7 +156,7 @@ def decode_osv1(stream, level=-0.35): state = 'wait' else: # Falling edge (end of HIGH level) - if (1500 < time < 2500): + if (1300 < time < 2500): if bit == 1: # a short HIGH time is a repeated 1 bit pkt.append(1) @@ -220,7 +219,7 @@ def hex(self): stream = rtlsdr_am_stream(freq, freq_offs, decimate_am=2, play_audio=options.audio) stream.start() unit = 'F' - for packet in decode_osv1(stream): + for packet in decode_osv1(stream, level): flags = [] if not packet.valid: