Repository navigation
v0.5.2: Critical Handshake Protocol Fix
🚨 Critical Hotfix
IMPORTANT: This release fixes a critical protocol bug that was the actual root cause of the CM160 historical sync issue.
Root Cause Identified
The device sends IDTWAITPCR (with 'R' at the end) but the library was only checking for IDTWAITPC (missing 'R'). This caused the handshake to fail completely, leading to the infinite loop described in the bug report.
Technical Fix
- Protocol Correction: Fixed
ID_WAIT_HISTORYconstant from"IDTWAITPC"to"IDTWAITPCR" - Buffer Decoding: Extended message decoding from bytes 1-9 to 1-10 to capture the full 10-character message
- Reference Compliance: Now matches the reference implementation exactly
Message Analysis
Bug report showed device sending: a949445457414954504352
- Decoded:
IDTWAITPCR(10 characters) - Previous code only checked:
IDTWAITPC(9 characters) - Result: Handshake never completed, causing infinite loop
Impact
This was the actual root cause of the CM160 getting stuck in historical sync mode. The timeout fix in v0.5.1 helped as a workaround, but this fix addresses the fundamental protocol issue.
Recommendation: Upgrade immediately from v0.5.1 for proper protocol compliance.