I have 1 task that implements about 8 different LED flashing algorithms.
I have a global varible that indicated that algorithm is currently set.
This varible is check in the task and then the LED algorithm is executed.
I have a function that is called to set the current algorithm,
If this function is called i want the task to stop what it is doing and start the new algorithm.
Currently it has to wait 1 cycle before it starts the new one.
Would i be better looking a using co-routines, 1 for each LED algorithm.
How about, instead of blocking using a delay, block on a queue read. Then if you want to change algorithms during the delay you wake the task by posting to the queue. The task recognises it has been woken before the end of the delay by the xQueueRead return value.
You could even get rid of the global variable then and post the algorithm that should be run on the queue.
yeah the suspend and resume doesn’t do what i want. IF i suspend the task, then resume it, it contines from where it was, thus still executing the complete cycle.
The queue read sounds like a possibility. I will have a think about that a little more. Thanks