fix(framing): checksum_valid sums the reply's payload unescaped
S3FrameParser summed its payload with the kept `10` of each `10 02/03/04` still in, so checksum_valid was False on about a third of good replies (the old "S3 checksums frequently fail" belief). SUM8 of the unescaped payload is the unit's checksum on 7,747 of 7,747 recorded replies; the test pins it on the 2,509 in the committed October fixtures (62 with an escaped checksum), which also proves #58's split of data from checksum on real replies. Nothing decides on checksum_valid; seismo_lab's display stops crying wolf. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
This commit is contained in:
1 parent
89c5234ac0
commit
47da0ddef0
2 files changed
+17
-1
No files matched your search
@@ -764,7 +764,9 @@ class S3FrameParser:
|
||||
n_chk = 2 if body[-2] == DLE and body[-1] in (STX, ETX, 0x04) else 1
|
||||
raw_payload = body[:-n_chk] # everything except the checksum
|
||||
chk_received = body[-1]
|
||||
chk_computed = checksum(raw_payload)
|
||||
# SUM8 of the payload unescaped: the kept `10` of a `10 02/03/04` is not
|
||||
# summed (7,747 of 7,747 recorded replies check this way).
|
||||
chk_computed = checksum(unescape_reply(raw_payload))
|
||||
|
||||
if len(raw_payload) < 5:
|
||||
return None
|
||||
|
||||
Reference in new issue
Block a user