Skip to content

fix error when no header requested #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 30, 2018
Merged
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
10 changes: 5 additions & 5 deletions adafruit_rfm69.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,11 +779,11 @@ def receive(self, timeout=0.5, keep_listening=True, with_header=False,
else:
packet = bytearray(fifo_length)
device.readinto(packet)
if (rx_filter != _RH_BROADCAST_ADDRESS and packet[0] != _RH_BROADCAST_ADDRESS
and packet[0] != rx_filter):
packet = None
if not with_header: # skip the header if not wanted
packet = packet[4:]
if (rx_filter != _RH_BROADCAST_ADDRESS and packet[0] != _RH_BROADCAST_ADDRESS
and packet[0] != rx_filter):
packet = None
elif not with_header: # skip the header if not wanted
packet = packet[4:]

# Listen again if necessary and return the result packet.
if keep_listening:
Expand Down