You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a message sender writes a message that is longer than the receiver is expecting to handle, there is no way to discard the message other than to perform a message buffer reset. Of course, a message buffer reset will discard all messages, not just the message with the problematic length. For more robust error recovery, I think it would be useful to have a way to discard a message without requiring a buffer large enough to hold whatever message may be sent.
I suggest adding a new function like xMessageBufferDiscard(MessageBufferHandle_t xMessageBuffer, TickType_t xTicksToWait ). (I'm unsure whether a timeout param is appropriate here.) Alternatively, and perhaps better, would be to allow xMessageBufferReceive to discard a message if the pvRxData parameter is NULL.
For the time being, I will probably change my sending code to prevent messages that are too long. I will also issue a message buffer reset if a too long message is received.
Ran into the same issue when I tryed to implement a message fifo. There is no way to discard old messages to make space for new ones directly, in my situation available ram is not an issue but reading and copying the message just for discarding it seems wastefull when the solution seems pretty easy like passing null in pointer or implement a new "discard" function.
If a message sender writes a message that is longer than the receiver is expecting to handle, there is no way to discard the message other than to perform a message buffer reset. Of course, a message buffer reset will discard all messages, not just the message with the problematic length. For more robust error recovery, I think it would be useful to have a way to discard a message without requiring a buffer large enough to hold whatever message may be sent.
I suggest adding a new function like xMessageBufferDiscard(MessageBufferHandle_t xMessageBuffer, TickType_t xTicksToWait ). (I'm unsure whether a timeout param is appropriate here.) Alternatively, and perhaps better, would be to allow xMessageBufferReceive to discard a message if the pvRxData parameter is NULL.
For the time being, I will probably change my sending code to prevent messages that are too long. I will also issue a message buffer reset if a too long message is received.
See the forum discussion here
The text was updated successfully, but these errors were encountered: