mauromoreyra wrote on Monday, October 21, 2019:
Hi everybody!, i’m new in this forum, working last year with FreeRTOS.
I’m using a FIFO queue with xQueueSendToFront… But i don’t find the way to accomplish the following: when the queue is full, if a new element is sent, “shift” all elements one position to back, and “throw overboard” the oldest element in the queue.
Someone can tell me if there is a way to implement this with FreeRTOS Queues API?
Or if anyone has faced the same problem and was able to solve it?
Any help will be welcome!
Graphically is better explained:
Full queue + sending new element
rtel wrote on Monday, October 21, 2019:
I’m afraid there is no way to do this. As you are using ‘send to front’
the oldest item is effectively at the back of the queue. If you were
using ‘send to back’ then you could effect what you wanted by removing
the front of the queue first, or using queue overwrite (or maybe queue
overwrite is only for queues with length 1?).
mauromoreyra wrote on Monday, October 28, 2019:
Thanks for your reply Richard!, i will consider what you say, but really i need to keep in the front of the queue the latest elements…
About queue overwrite, yes, it only works with queues with length = 1.