Skip to content

Discard received message #1173

Answered by jgromes
polys96 asked this question in Q&A
Discussion options

You must be logged in to vote

@polys96 this is basically the default behavior - as @HeadBoffin pointed out, you only get the the number of bytes you specify in readData, anything above that limit is discarded. So if you call readData(buffer, 50) you will never get more than 50 bytes. However, you always have to provide a large enough memory buffer where the received data is to be stored.

I would like to point out though that your use case seems slightly odd. Of course, I don't know the context, but I don't think it will help you much with memory usage (program memory? data memory?) to be storing 50 bytes of each message, since the maximum packet length is 255 bytes anyway - unless each device keeps some log of past me…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by polys96
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants