Is there way to check ‘timer command queue’ what space is available - something like uxQueueSpacesAvailable() or some other way to find proper value for configTIMER_QUEUE_LENGTH?
Thanks
I don’t know of any API available to get that value, as I believe the queue is private within the file with the timer task. It might not be a bad addition to have it keep track (at least optionally) of the ‘high water mark’ of the queue.
Now, if as is often recommended, the Timer Service task is made high priority, then most task submitting something to the queue won’t build the queue up, as the system will immediately switch over to it (since it is higher priority), and won’t run while callbacks are running as those are not supposed to block. That means that you just need to have room for how every many items might be put on in a short period by ISRs, timer callbacks, and any other tasks with a priority higher than it (which should be few).
Perhaps a good feature request - high water marks on queues?
It could be done in the queue itself, at the cost of 1 word to every queue, and a size test in the critical section that add data to the queue to see if it is fuller that previously. This should only be enable with a #define in FreeRTOSConfig.h
A second option would be to have the Timer/Service task itself measure its high water mark by seeing how full the queue is right after it takes each item from the queue (That could be off by 1 if something adds to the queue between the popping of the item off and the task seeing how full the queue is now.)