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.22k stars 224 forks source link

Argument with task #80

Closed afagard closed 4 years ago

afagard commented 4 years ago

Love the lib, even though it is a bit hard for me to follow some of the examples (so many callbacks).

In any case, I was wondering if there was a way to pass an argument with a task:

e.g.

Task tUpdateRtc(1UL * 60UL * 1000UL, TASK_FOREVER, &updateRtc(true), &hpr); // every 1 minute

arkhipenko commented 4 years ago

No easy way to do it with Dynamic Tasks calling static callback methods. You can use Local Task Storage pointer for this. Wiki: here Example: here