Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRSF frame sanity check incorrect. #28

Closed
hydra opened this issue Mar 2, 2023 · 1 comment
Closed

CRSF frame sanity check incorrect. #28

hydra opened this issue Mar 2, 2023 · 1 comment

Comments

@hydra
Copy link

hydra commented Mar 2, 2023

From the TBS spec, "Frame Length: ... Valid range is between 2 and 62 ...".

But:

if (len < 3 || len > CRSF_MAX_PACKET_LEN)

and:

#define CRSF_MAX_PACKET_LEN 64

CRSF 'FrameLength' field != CRSF BUFFER SIZE / CRSF_MAX_PACKET_LEN.

@CapnBry
Copy link
Owner

CapnBry commented Mar 7, 2023

🤣 It is so ambiguous everywhere what the max was, especially when I wrote this and had a lot less experience with everyone's implementation (which is the only spec I know). I've updated the code to clarify. I didn't know if the original define (64) was supposed to represent:

  • The max total packet size. The size of the buffer need to hold an entire CRSF packet including the start byte, len, type, payload and CRC. The payload data is limited to 60 bytes. TRUE
  • The max total size of everything following the length. FALSE
  • The max total size of the payload portion, including TYPE, excluding the CRC. FALSE
  • The max total size of the data portion of the payload, excluding the TYPE and CRC. FALSE

@CapnBry CapnBry closed this as completed May 8, 2023
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

No branches or pull requests

2 participants