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

Fix issue #9. MAX_PAYLOAD warning #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

0x3333
Copy link

@0x3333 0x3333 commented Oct 27, 2024

For context, MAX_PAYLOAD is 255 by default, rx_frame_length is uint8_t, which means that is limited to 255. When compiling, it issues a warning:

/Users/0x3333/Code/g6/deps/min/target/min.c:507:39: warning: comparison is always true due to limited range of data type [-Wtype-limits]
  507 |             if (self->rx_frame_length <= MAX_PAYLOAD) {
      |                                       ^~

This PR checks if MAX_PAYLOAD is different from 255, and if it is, will check the length of the rx packet being received; if not, will just continue receiving, because the buffer is at its maximum size.

rx_frame_state = RECEIVING_PAYLOAD is set by default to simplify the #if, as it will be overwritten if rx packet is bigger anyways.

…ame length. Currently length is limited to 255(uint8_t).
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