Closed dr-mrsthemonarch closed 2 years ago
You cannot pass parameters to the callback methods. You have to use LTS for that - check appropriate examples.
https://github.com/arkhipenko/TaskScheduler/tree/master/examples/Scheduler_example08_LTS
#define _TASK_LTS_POINTER
…will compile TaskScheduler with support for Local Task Storage pointer (LTS). LTS is a generic (void*) pointer that could be set to reference a variable or a structure specific to a particular task. A callback method can get access to specific variables by getting a reference to a currently running task from the scheduler, and then casting (void*) LTS pointer to the appropriate pointer type.
NOTE: above parameters are DISABLED by default, and need to be explicitly enabled by placing appropriate #define statements in front of the #include statement for the TaskScheduler header file.
With this minimal Code:
I'm trying to create tasks that I can feed various values, rather than repeating code over and over again for various tasks. I have developed a CLI that can take different Integers to turn on or off different sensors through using SPI and chip select (some 16 differents sensors)
Though it seems this isn't possible, as I get the following error, or various different ones when trying to start a task callback with variables.
nor can I find in any of your (excellent) examples of this being done either. Is this not possible? Or is there a better way around this? Love using the library otherwise!