Maybe, the problem is that I don’t really understand the task concept. Probably we are looking at the problem from two different sides. For control applications (like PID control, etc.) I need the system tick of several, let’s say 10ms to give precise intervals to call the control function. Having this “base clock” I can do other different functions that should be called periodically like switch debouncing, reading analog inputs etc. To change the period of the “base clock” I simply count the timer interrupts for instance 100 times and I have 1second base for LEDs. In this concept I have two program spaces: while(1) loop for non time critical functions (like calculations) and timer driven functions for time critical functions (like control actions). That is really enough for most of embedded systems. This concept comes from low level programming that I was using first. After that I started to use C/C++ for control applications but trying to maintain the same well known structure using timers.
So I ask if this is possible to realize using Husarion framework?
Now returning to tasks. When I go through one of your examples: System_sys_task.cpp I see in the main function:
sys.taskCreate(&buzzer); // running task buzzer
sys.taskCreate(&motors); // running task motors
sys.taskCreate(&tog); //runing task tog
and one of the functions:
void buzzer() // creating instruction for buzzer
I understand that first I create and run some tasks like buzzer, motors and tog. They are running in different intervals because of different sys.delay().
But what happens if I have the same value in sys.delay()?
The next question is how many tasks can I create and how are they related to 100% of uP calculations ability? Is sys.delay() “wasting” the processor power - or it is made using timers?
How can I calculate how much processor power I have left in while(true) loop?