Skip to content

Fix issue #9. MAX_PAYLOAD warning#55

Open
0x3333 wants to merge 1 commit intomin-protocol:masterfrom
0x3333:issue_9
Open

Fix issue #9. MAX_PAYLOAD warning#55
0x3333 wants to merge 1 commit intomin-protocol:masterfrom
0x3333:issue_9

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