From 24c59579935b8ec0c5365605f5b004aa9768d55a Mon Sep 17 00:00:00 2001 From: sanni Date: Fri, 28 Oct 2022 12:56:38 +0200 Subject: [PATCH] Fix CRC32 calculation --- Cart_Reader/Cart_Reader.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cart_Reader/Cart_Reader.ino b/Cart_Reader/Cart_Reader.ino index b551b9d..5b008b3 100644 --- a/Cart_Reader/Cart_Reader.ino +++ b/Cart_Reader/Cart_Reader.ino @@ -548,7 +548,7 @@ uint32_t updateCRC(const byte *buffer, size_t length, uint32_t crc) { uint32_t calculateCRC(const byte *buffer, size_t length) { uint32_t crc = 0xFFFFFFFF; - updateCRC(buffer, length, crc); + crc = updateCRC(buffer, length, crc); return ~crc; } @@ -557,7 +557,7 @@ uint32_t calculateCRC(FsFile &infile) { uint32_t crc = 0xFFFFFFFF; while((byte_count = infile.read(sdBuffer, sizeof(sdBuffer))) != 0) { - updateCRC(sdBuffer, byte_count, crc); + crc = updateCRC(sdBuffer, byte_count, crc); } return ~crc; }