arkhipenko / TaskScheduler

Cooperative multitasking for Arduino, ESPx, STM32, nRF and other microcontrollers
http://playground.arduino.cc/Code/TaskScheduler
BSD 3-Clause "New" or "Revised" License
1.21k stars 221 forks source link

Scheduler not executing on ESP8266 #160

Closed creahard closed 1 year ago

creahard commented 1 year ago

I'm trying to use this library on an ESP8266 which I have used many times before, but I am migrating to PlatformIO vs Arduino IDE. Compiling and running the code below in the Arduino IDE with ESP8266 Core 2.7.4 runs correctly. I haven't been able to get ANY code using Core 3.0.2 to boot without an endless loop of exceptions and rebooting. Using PlatformIO and espressif8266 Core 3.0.2 it compiles and boots but the execute method of the Scheduler doesn't appear to run.

My main question is has version 3.7.0 of TaskScheduler been tested on an ESP8266 built with the latest espressif core framework?

+++++++++++test.ino / main.cpp+++++++++++++

include

include

Scheduler runner;

void blinkSerial(void) { Serial.println("+"); }

Task serialBlink(1000, TASK_FOREVER, blinkSerial);

void setup() { // put your setup code here, to run once: Serial.begin(115200); Serial.println(); Serial.println(); Serial.println("Setting up task scheduler."); runner.init(); Serial.println("Adding serialBlink task."); runner.addTask(serialBlink); Serial.println("Setup is complete."); }

void loop() { // put your main code here, to run repeatedly: runner.execute(); }

arkhipenko commented 1 year ago

I think you are missing serialBlink.enable(); at the end of setup()

Could you try with that added please?

Thanks

Sent from my mobile implant. Apologies for autocorrect.


From: creahard @.> Sent: Wednesday, December 21, 2022, 12:13 PM To: arkhipenko/TaskScheduler @.> Cc: Subscribed @.***> Subject: [arkhipenko/TaskScheduler] Scheduler not executing on ESP8266 (Issue #160)

I'm trying to use this library on an ESP8266 which I have used many times before, but I am migrating to PlatformIO vs Arduino IDE. Compiling and running the code below in the Arduino IDE with ESP8266 Core 2.7.4 runs correctly. I haven't been able to get ANY code using Core 3.0.2 to boot without an endless loop of exceptions and rebooting. Using PlatformIO and espressif8266 Core 3.0.2 it compiles and boots but the execute method of the Scheduler doesn't appear to run.

My main question is has version 3.7.0 of TaskScheduler been tested on an ESP8266 built with the latest espressif core framework?

+++++++++++test.ino / main.cpp+++++++++++++

include

include

Scheduler runner;

void blinkSerial(void) { Serial.println("+"); }

Task serialBlink(1000, TASK_FOREVER, blinkSerial);

void setup() { // put your setup code here, to run once: Serial.begin(115200); Serial.println(); Serial.println(); Serial.println("Setting up task scheduler."); runner.init(); Serial.println("Adding serialBlink task."); runner.addTask(serialBlink); Serial.println("Setup is complete."); }

void loop() { // put your main code here, to run repeatedly: runner.execute(); }

— Reply to this email directly, view it on GitHubhttps://github.com/arkhipenko/TaskScheduler/issues/160, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AACMMTN5H53B3PCVBHY2RLDWOM3CPANCNFSM6AAAAAATF3DP54. You are receiving this because you are subscribed to this thread.Message ID: @.***>

creahard commented 1 year ago

Well, that was embarrassing. That was the missing piece. When I took a quick read through the larger source code I'm porting over I completely missed the enable method on some of the tasks (others get restartDelayed).

My apologies. Thank you very much for the quick reply!

arkhipenko commented 1 year ago

No worries. Happens to the best of us.

Sent from my mobile implant. Apologies for autocorrect.


From: creahard @.> Sent: Thursday, December 22, 2022 11:48:01 AM To: arkhipenko/TaskScheduler @.> Cc: Anatoli Arkhipenko @.>; Comment @.> Subject: Re: [arkhipenko/TaskScheduler] Scheduler not executing on ESP8266 (Issue #160)

Well, that was embarrassing. That was the missing piece. When I took a quick read through the larger source code I'm porting over I completely missed the enable method on some of the tasks (others get restartDelayed).

My apologies. Thank you very much for the quick reply!

— Reply to this email directly, view it on GitHubhttps://github.com/arkhipenko/TaskScheduler/issues/160#issuecomment-1363089195, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AACMMTNZTN6IH6WHRWBPRP3WOSA4DANCNFSM6AAAAAATF3DP54. You are receiving this because you commented.Message ID: @.***>