Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions decode_os433.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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'
Expand All @@ -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):
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down