From 74c950f7fc9edd4a4d15b17a1f29f1869d05b247 Mon Sep 17 00:00:00 2001 From: Witold Baryluk Date: Wed, 15 Nov 2023 12:20:17 +0100 Subject: [PATCH] Pass bytearray to crc checksum calculator Closes: https://github.com/baryluk/fnirsi-usb-power-data-logger/issues/12 Related: https://github.com/Nicoretti/crc/issues/113 --- fnirsi_logger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fnirsi_logger.py b/fnirsi_logger.py index 1605749..91fed5a 100755 --- a/fnirsi_logger.py +++ b/fnirsi_logger.py @@ -141,7 +141,7 @@ def decode(data, calculate_crc, time_interval): if calculate_crc: actual_checksum = data[-1] - expected_checksum = calculate_crc(data[1:-1]) + expected_checksum = calculate_crc(bytearray(data[1:-1])) if actual_checksum != expected_checksum: print( f"Ignoring packet of length {len(data)} with unexpected checksum. "