fix: Update CRC calc to use 0 init and full 16-bit stored value
Some checks failed
Build Linux / Build Linux (push) Successful in 1m27s
Build Windows / Build Windows (push) Failing after 17s

This commit is contained in:
2026-02-07 10:47:29 +01:00
parent 6a6df63980
commit 84d1094d16

View File

@@ -82,8 +82,9 @@ class Page:
Row 0: Skips first 8 bytes (Header/Control). Uses bytes 8-39.
Rows 1-23: Uses all 40 bytes.
Data is 7-bit (stripped parity).
Initial value: 0 (ETSI EN 300 706 9.4.1.2).
"""
crc = 0xFFFF
crc = 0
poly = 0x1021
# Helper to update CRC with a byte
@@ -135,13 +136,13 @@ class Page:
if designation == 0:
# Packet 27/0
# Checksum is in bytes 38 and 39
# Checksum is in bytes 38 and 39.
# ETSI EN 300 706: 8 bits of each byte are used.
if len(p.data) >= 40:
hi = p.data[38]
lo = p.data[39]
# Strip parity
crc = ((hi & 0x7F) << 8) | (lo & 0x7F)
crc = (hi << 8) | lo
return crc
except:
pass