From 8ba8b3f2f82e6c86a8d7f54dd8f4523f1989fc97 Mon Sep 17 00:00:00 2001 From: Jerry Needell Date: Sun, 30 Dec 2018 15:09:17 -0500 Subject: [PATCH] fix possible bad packet handling --- adafruit_rfm9x.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/adafruit_rfm9x.py b/adafruit_rfm9x.py index 53ce6b2..2289e6e 100644 --- a/adafruit_rfm9x.py +++ b/adafruit_rfm9x.py @@ -630,11 +630,11 @@ def receive(self, timeout=0.5, keep_listening=True, with_header=False, packet = bytearray(length) # Read the packet. self._read_into(_RH_RF95_REG_00_FIFO, packet) - 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:] + 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: self.listen()