Closed vadimostanin closed 5 years ago
It's a bug. I guess I have never used and therefore tested deleting a task from the chain and then adding it back.
runner.addTask(t2);
t2.enable();
t2.disable();
runner.deleteTask(t2);
runner.addTask(t2);
t2.enable();
Will fix in the testing branch in the nearest and release with 3.0
Pushed into testing
branch. Will be released with major 3.X release.
Hello,
Thanks for your library. I found this bug when I tried to restart workflow of some task. This bug isn't critical, although it is quite normal test of library.
//Task t2 isn't launched in t1
include
// Callback methods prototypes void t1Callback();void t2Callback();
//Tasks Task t1(2000, 3, &t1Callback); Task t2(5000, TASK_FOREVER, &t2Callback);
Scheduler runner;
void t1Callback() { Serial.print("t1: "); Serial.println(millis()); if (t1.isLastIteration()) { runner.addTask(t2); t2.enable(); t2.disable(); runner.deleteTask(t2); runner.addTask(t2); t2.enable(); Serial.println("t1: start, stop, start, t2"); } }
void t2Callback() { Serial.print("t2: "); Serial.println(millis());
}
void setup () { Serial.begin(9600); Serial.println("Scheduler TEST");
runner.init(); Serial.println("Initialized scheduler");
runner.addTask(t1); Serial.println("added t1");
t1.enable(); Serial.println("Enabled t1"); }
void loop () { runner.execute(); }