Skip to content

Commit c22fc0d

Browse files
authored
Merge pull request #15 from jerryneedell/jerryn_fix_garbage
fix possible bad packet handling
2 parents c502696 + 8ba8b3f commit c22fc0d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

adafruit_rfm9x.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -630,11 +630,11 @@ def receive(self, timeout=0.5, keep_listening=True, with_header=False,
630630
packet = bytearray(length)
631631
# Read the packet.
632632
self._read_into(_RH_RF95_REG_00_FIFO, packet)
633-
if (rx_filter != _RH_BROADCAST_ADDRESS and packet[0] != _RH_BROADCAST_ADDRESS
634-
and packet[0] != rx_filter):
635-
packet = None
636-
elif not with_header: # skip the header if not wanted
637-
packet = packet[4:]
633+
if (rx_filter != _RH_BROADCAST_ADDRESS and packet[0] != _RH_BROADCAST_ADDRESS
634+
and packet[0] != rx_filter):
635+
packet = None
636+
elif not with_header: # skip the header if not wanted
637+
packet = packet[4:]
638638
# Listen again if necessary and return the result packet.
639639
if keep_listening:
640640
self.listen()

0 commit comments

Comments
 (0)