Răsfoiți Sursa

v4.0.3: fixed bug in _TASK_TICKLESS mode

Anatoli Arkhipenko 2 luni în urmă
părinte
comite
3273f6eb26
4 a modificat fișierele cu 11 adăugiri și 3 ștergeri
  1. 1 1
      README.md
  2. 1 1
      library.json
  3. 1 1
      library.properties
  4. 8 0
      src/TaskScheduler.h

+ 1 - 1
README.md

@@ -1,6 +1,6 @@
 # Task Scheduler
 ### Cooperative multitasking for Arduino, ESPx, STM32 and other microcontrollers
-#### Version 4.0.2: 2025-10-09 [Latest updates](https://github.com/arkhipenko/TaskScheduler/wiki/Latest-Updates)
+#### Version 4.0.3: 2025-11-02 [Latest updates](https://github.com/arkhipenko/TaskScheduler/wiki/Latest-Updates)
 
 [![arduino-library-badge](https://www.ardu-badge.com/badge/TaskScheduler.svg?)](https://www.ardu-badge.com/TaskScheduler)
 

+ 1 - 1
library.json

@@ -16,7 +16,7 @@
       "maintainer": true
     }
   ],
-  "version": "4.0.2",
+  "version": "4.0.3",
   "frameworks": "arduino",
   "platforms": "*"
 }

+ 1 - 1
library.properties

@@ -1,5 +1,5 @@
 name=TaskScheduler
-version=4.0.2
+version=4.0.3
 author=Anatoli Arkhipenko <arkhipenko@hotmail.com>
 maintainer=Anatoli Arkhipenko <arkhipenko@hotmail.com>
 sentence=Cooperative multitasking for Arduino, ESPx, STM32 and other microcontrollers.

+ 8 - 0
src/TaskScheduler.h

@@ -300,6 +300,9 @@ v4.0.2:
     2025-10-09:
         - added unit test for _TASK_THREAD_SAFE functionality
 
+v4.0.3:
+    2025-11-02:
+        - bug: next execution time with _TASK_TICKLESS did not take task timeout into account
 */
 
 #include "TaskSchedulerDeclarations.h"
@@ -1674,6 +1677,11 @@ bool Scheduler::execute() {
                     unsigned long nextrun = iCurrent->iDelay + iCurrent->iPreviousMillis;
                     // nextrun should be after current millis() (except rollover)
                     // nextrun should be sooner than previously determined
+#ifdef _TASK_TIMEOUT
+                    // in case timeout is set - we have to consider it as well
+                    unsigned long untilto = iCurrent->untilTimeout() + iCurrent->iPreviousMillis;
+                    if ( untilto < nextrun ) nextrun = untilto;
+#endif  // _TASK_TIMEOUT
                     if ( nextrun > m && nextrun < nr ) { 
                         nr = nextrun;
                         nrd |= _TASK_NEXTRUN_TIMED; // next run timed