Comments (5)
I am always open to improving the functionality of TaskScheduler, given that it maintains small memory footprint and scheduling overhead. The primary target platform is microcontrollers, which [used to] have small amount of RAM to work with, so every byte and every tick counts.
That partially explains why everything about Tasks is so explicit - to minimize the time to get to callback functionality. Since the function pointer is explicit, and no parameters need to be pushed into stack, the callback happens relatively quickly. Using overloaded functions will (in my opinion) add scheduling overhead, so I would like to understand what is the use case for your request?
If you would like to use the same callback code for different tasks, consider using the Local Task Storage pointer functionality. Every Task can store a pointer to its specific data structure. Callback can get a reference to current task from the scheduler and access task specific variables. There is a chapter about that in the documentation.
Hope this helps. But would be happy to continue the discussion in case I am missing some very useful way of using Tasks that is not achievable as is.
Thanks!
PS: Are you using TaskScheduler, and if yes, what for?
from taskscheduler.
Thank you very much for such detailed answer.
No, I didn't notice the _TASK_LTS_POINTER. I think it is everything I need for now, I'll test it today.
I am looking for a good multitasking framework that will power my future Arduino projects. The first project at hand is my "smart bathroom":
There are 2 Arduinos in my bathroom. The main one is connected to an external CD74HC4067 LED PWM controller that powers powerful 4x4 led stripes (RGB, white and red), motion detector, hall effect based opened doors detector, TCS34725 colour detector (for calibration of LED colours), real time clock, a switch that controls floor heating pump, thermometer and another bathtub Arduino that controls 3 thermometers connected to my bath tub (to measure water temperature and - indirectly - water level), two extra LED stripes + one WS2812B vertical stripe with a nice animation of fire). I also want to test infra-red pilot for more control over the modes.
In the future, beside the autonomous work, The Arduino will be connected (serially via USB, so I could re-program Arduino remotely) with Raspberry Pi, that will do voice recognition and display a nice touchscreen with StarTrek-themed control panel :-).
So there is a loot of simultaneous work to do (lights, bathtub, heating and being managed by Pi).
The second project will be a sort of Jedi-saber for my son. It will be battery-powered, so I want to press for power-efficient design. By design the saber will have ca. 100 WS2812B neopixel stripe, accelerometer, a touch sensor and maybe a flex sensor. I want it to be capable of showing a nice picture when rotated, and show nice animation when touched/wiggled/bent.
from taskscheduler.
Sounds very exciting! Do you have a web page (or instructables page) to look at it?
from taskscheduler.
Nope. Not yet. But thinking of it - why not? I'll try, but I cannot promise when. It is just that tinkering with electronics is only my hobby, and I barely find time for it.
from taskscheduler.
Yeah. Finding time is the biggest problem... I can relate. Good luck!
from taskscheduler.
Related Issues (20)
- ESP32 dual core usage HOT 2
- V3.7.0 kills ESP32 WiFi HOT 2
- Scheduler not executing on ESP8266 HOT 3
- fluently change task interval, within another tasks periodicity HOT 5
- Least possible scheduling time HOT 9
- Set the core where a task execute HOT 2
- Declare task to run with delay HOT 2
- Keep trying if 'onEnable' fails HOT 8
- Method to get the name of the Callback registered in the Task HOT 7
- Async Webserver problem HOT 10
- esp32-c3 freezing after for tasks over 5800ms with _TASK_SLEEP_ON_IDLE_RUN. Regular esp32 works fine. HOT 2
- Library Suggestion HOT 1
- TaskScheduler Task Callbacks With OO in Callback HOT 2
- ODR Violation With Multiple Uses of TaskScheduler Throughout a Project HOT 1
- The banner link in README.md isn't working. HOT 1
- Compilation error when try to warp TaskScheduler's Task and execute() in a class HOT 2
- `_TASK_STD_FUNCTION` should be for everyone.
- enableDelayed() calls Callback immediately HOT 2
- C++ compiler warning: compound assignment with 'volatile'-qualified left operand is deprecated HOT 14
- "multiple definition of" linker errors if TaskScheduler.h included in multiple header/source files HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from taskscheduler.