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.
For context,
MAX_PAYLOAD
is255
by default,rx_frame_length
is uint8_t, which means that is limited to 255. When compiling, it issues a warning: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.