I would like to control a periodic task by suspending and resuming it with vTaskSuspend.
Suppose I have a task that is running:
and in another task I suspend this one by calling
The problem which I encounter is that when I call:
the task "aTask" runs for the amount of times needed to reach the current tick time continuosly and then runs again periodically as vTaskDelayUntil tells. Obviously other tasks interrupt it.
This is not good as when I resume this task I want that this task runs periodically again, immediatly.
It seems that the variable LastWake is not updated well if I do a suspend/resume.
Please note that if I do a suspend which lasts some minutes, the task runs for a lot of times continuously, not respecting the 10ms delay time.
Is there something I can do?
Am I wrong in using suspend and resume?
Am I wrong in using vTaskDelayUntil (obviously I don’t want to use vTaskDelay as I want to perform the operations every 10 ms)?
Should I use instead a semaphore?
Any suggestion is appreciated, thanks.