I have tried to write some testing code using TaskScheduler library to learn how to work with it. The code was simple, just blinked with LED, but it didn't work. I've tried to construct one global task to execute using a default constructor without any parameters and in setup() function I've set task parameters such as call period (interval) and callback method as shown at the picture bellow.
While I was looking for a mistake, I also tried to print all set values of the task including that weren't set by me, but were default.
According to code shown above I've got these values: interval = 1000 ms, enabled status = true, but I've been supprised by the iterations count = 0.
I've read Yours wiki and I think that the iterations count should be set to -1 by default according to text bellow:
"Default constructor.
Takes no parameters and creates a task that could be scheduled to run at every scheduling pass indefinitely, but does not have a callback method defined, so no code execution will actually take place."
After inserting line which sets iterations count of the task explicitely to indefinitely (-1) the code worked properly.
Is the wiki information mistaken and the 0 value has specific reason, or the 0 value is incorrectly defined as default, or I've just understood the information wrongly?
Thank You for answer gratefully.
I have tried to write some testing code using TaskScheduler library to learn how to work with it. The code was simple, just blinked with LED, but it didn't work. I've tried to construct one global task to execute using a default constructor without any parameters and in setup() function I've set task parameters such as call period (interval) and callback method as shown at the picture bellow.
While I was looking for a mistake, I also tried to print all set values of the task including that weren't set by me, but were default.
According to code shown above I've got these values: interval = 1000 ms, enabled status = true, but I've been supprised by the iterations count = 0.
I've read Yours wiki and I think that the iterations count should be set to -1 by default according to text bellow:
"Default constructor. Takes no parameters and creates a task that could be scheduled to run at every scheduling pass indefinitely, but does not have a callback method defined, so no code execution will actually take place."
Looking into code of the library TaskSchedulerDeclarations.h on the lines 163 and 165 there is preset value 0 for iterations parameter. https://github.com/arkhipenko/TaskScheduler/blob/776cb42397c6e059612cbb47709820c2d35386d4/src/TaskSchedulerDeclarations.h#L163 https://github.com/arkhipenko/TaskScheduler/blob/776cb42397c6e059612cbb47709820c2d35386d4/src/TaskSchedulerDeclarations.h#L165
After inserting line which sets iterations count of the task explicitely to indefinitely (-1) the code worked properly.
Is the wiki information mistaken and the 0 value has specific reason, or the 0 value is incorrectly defined as default, or I've just understood the information wrongly? Thank You for answer gratefully.