diff --git a/adafruit_pm25/uart.py b/adafruit_pm25/uart.py index cb7d76d..c6603b7 100644 --- a/adafruit_pm25/uart.py +++ b/adafruit_pm25/uart.py @@ -216,7 +216,7 @@ def _read_uart(self): serial_data.append(ord(second_byte)) frame_length_bytes = self._uart.read(2) frame_length = int.from_bytes(frame_length_bytes, "big") - if frame_length in range(0, (MAX_FRAME_SIZE - 4)): + if 0 <= frame_length <= (MAX_FRAME_SIZE - 4): serial_data.extend(frame_length_bytes) data_frame = self._uart.read(frame_length) if len(data_frame) > 0: