arkhipenko / TaskScheduler

Cooperative multitasking for Arduino, ESPx, STM32, nRF and other microcontrollers
http://playground.arduino.cc/Code/TaskScheduler
BSD 3-Clause "New" or "Revised" License
1.32k stars 243 forks source link

How to get 'untilInterval'? #135

Closed vatsake closed 2 years ago

vatsake commented 2 years ago

I can get the interval with getInterval(), but is there a way to see time UNTIL the task runs? or calculate?

arkhipenko commented 2 years ago

I am not sure I understand the question. Do you want to know how much time until the Task will be invoked? You can do that from the scheduler: https://github.com/arkhipenko/TaskScheduler/wiki/API-Task-Scheduler#long-timeuntilnextiteration-task-atask

If you want to know how long the task is going to run - that depends on the callback code and cannot be estimated as the scheduler does not preempt - you have to return from the callback.

arkhipenko commented 2 years ago

You also need to appreciate the invocation is not guaranteed at that time - it depends on whether all the tasks in front of this one will behave and exit quickly for the schedule to hold.