Closed Schrolli91 closed 3 years ago
I did think about this. It would work only in very simple cases, and there are other issues with putting MCU to sleep for longer than 1 ms:
Since I have to maintain TS for general purpose I chose not to implement longer sleep intervals.
You can use this method: https://github.com/arkhipenko/TaskScheduler/wiki/API-Task-Scheduler#long-timeuntilnextiteration-task-atask for simple cases with just a few tasks, but remember - you need to reset the scheduling after wake up since millis() will be off.
thank you for your comments. I think you are right with the points given.
I think thats not possible at the moment - but maybe a nice-to-have feature.
Is it possible to get the time from scheduler, when the next task should be run? If i know, when next task should be run, i can sleep until this time. Maybe this can reduce power consumption a lot.
I have tested this in a little proof of concept where i calc the shortest time to the next task run in the sleep callback. At a first look it looks like working properly - maybe thats a nice feature for the future?
Have you thought about such a function till now - and do you think that there are some architecture problems for code this in a fast and stable way?
My quick-and.dirty test has reduced my power consumtion round about 50% (calced sleep time <> sleep time fixed 1000us)