Skip to content

♻️ #171: Compute the frame checksum instead of replaying it - #175

Closed
nofuturekid wants to merge 1 commit into
OpenFoxes:mainfrom
nofuturekid:feature/#171-compute-frame-checksum
Closed

nofuturekid wants to merge 1 commit into
OpenFoxes:mainfrom
nofuturekid:feature/#171-compute-frame-checksum

Conversation

@nofuturekid

Copy link
Copy Markdown

Refs #171

Implements the checksum part of #171 (thanks @gnacho for working it out): command02 with captured checksum/sequence pairs is replaced by frame.rs, which builds the frame from receiver, command id and data and computes both CRC-16/USB values. Each camera gets its own sequence counter; the camera ignores a frame that repeats the previous sequence number.

Sleep, tracking speed, exposure mode type and preset recall now use it with unchanged bytes. Their tests build the frames with the captured sequence numbers and must reproduce the captured frames exactly, which also checks the CRC. cargo test --all-features passes; sleep/wake and speed were checked on a Tiny 2 Lite.

Written with Claude Code (AI).

🤖 Generated with Claude Code

Framed commands on unit 2, selector 2 carry two CRC-16/USB checksums
(reflected polynomial 0xA001, init and final XOR 0xFFFF): one over the
12-byte header and one over the data block, each with its own field
zeroed. Until now every command replayed a captured checksum together
with its captured sequence number, so no new command could be added
without a capture.

The new frame builder takes receiver, command id and data and computes
both checksums. Each camera hands out its own sequence numbers, seeded
from the clock, because the camera drops a frame that repeats the
previous sequence number.

Sleep, tracking speed, exposure mode type and preset recall now use the
builder. Their tests build with the captured sequence numbers and check
that the captured frames come out byte for byte, which proves the
checksums.

Thanks to gnacho for working out the checksum in #171.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nofuturekid

Copy link
Copy Markdown
Author

Closing this: I moved the Tiny 2 Lite work to a separate tool, obsbot4linux, and won't maintain these changes here. The protocol notes and captures stay public in obsbot-tiny2-lite-protocol in case they help. Thanks for the project! (Written with Claude Code.)

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