Skip to content

Uploads give the file's CRC16, and skip filehash when the device checked it - #4

Merged
robdobsn merged 1 commit into
mainfrom
feature/upload-crc-check
Oct 25, 2026
Merged

robdobsn merged 1 commit into
mainfrom
feature/upload-crc-check

Conversation

@robdobsn

Copy link
Copy Markdown
Owner

Summary

  • ufStart now includes "CRC16":"0x....", the CRC16-CCITT that filehash reports.
  • With firmware that checks it (File uploads: check the file against the CRC16 given in ufStart RaftCore#29), the device compares the written file with that CRC:
    • on a mismatch it cancels the upload (failCRC) and deletes the file, and RaftCLI reports that the file didn't match what was sent;
    • on a match the ufEnd reply carries crc16, and RaftCLI skips its separate filehash request, one round trip less per upload, which helps most over BLE.
  • Older firmware ignores the CRC and gives no crc16, so the upload is checked with filehash as before.

The simulated device does the same, with check_crc on by default and switchable off to behave like older firmware. The tests cover both.

Testing

  • cargo test: 129 pass, and clippy has no new warnings.
  • Against an Axiom with RaftCore #28 and #29: 200 KB uploads over HTTP, WebSocket, serial and BLE all succeeded and read back identical, with no dropped frames or resends.

🤖 Generated with Claude Code

…ked it

ufStart now includes "CRC16":"0x...." (CRC16-CCITT, as filehash reports it).
Firmware from 2026-10-25 (RaftCore) checks the uploaded file against it once
written: a mismatch cancels the upload (failCRC) and the device deletes the
file; a match is confirmed in the ufEnd reply (crc16), and then the separate
filehash request is skipped - one round trip less per upload, which matters
over BLE. Older firmware ignores the CRC, gives no crc16, and the upload is
checked with filehash as before.

The simulated device does the same (check_crc, on by default; off for older
firmware), and the tests cover both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@robdobsn
robdobsn merged commit 5be3d1b into main Oct 25, 2026
6 checks passed
@robdobsn
robdobsn deleted the feature/upload-crc-check branch October 25, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant