@@ -138,8 +138,6 @@ enum TimerUnit : uint8_t {
138138 TM_TIME_RUNNING = 0x20 ,
139139};
140140
141- #define EXECMODE_BIT_DISABLED 4
142-
143141/* *
144142 * Internal class.
145143 * The execution types stored internally in a task, records what kind of task is in use, and if it needs deleting
@@ -152,7 +150,6 @@ enum ExecutionType : uint8_t {
152150
153151 EXECTYPE_MASK = 0x03 ,
154152 EXECTYPE_DELETE_ON_DONE = 0x08 ,
155- EXECTYPE_TASK_DISABLED = 0x10 ,
156153
157154 EXECTYPE_DEL_EXECUTABLE = EXECTYPE_EXECUTABLE | EXECTYPE_DELETE_ON_DONE,
158155 EXECTYPE_DEL_EVENT = EXECTYPE_EVENT | EXECTYPE_DELETE_ON_DONE
@@ -198,6 +195,8 @@ class TimerTask {
198195 tm_internal::TmAtomicBool taskInUse;
199196 /* * the mode in which the task executes, IE call a function, call an event or executable. Also if memory is owned */
200197 volatile ExecutionType executeMode;
198+ /* * Stores a flag to indicate if the task is enabled */
199+ tm_internal::TmAtomicBool taskEnabled;
201200public:
202201 TimerTask ();
203202
@@ -323,13 +322,13 @@ class TimerTask {
323322 /* *
324323 * @return if the task is presently enabled - IE it is being scheduled.
325324 */
326- bool isEnabled () { return ! bitRead (executeMode, EXECMODE_BIT_DISABLED) != 0 ; }
325+ bool isEnabled () { return tm_internal::atomicReadBool (&taskEnabled) ; }
327326
328327 /* *
329328 * Set the task aspi either enabled or disabled. When enabled it is scheduled, otherwise it is not scheduled.
330329 * @param ena the enablement status
331330 */
332- void setEnabled (bool ena);
331+ void setEnabled (bool ena) { tm_internal::atomicWriteBool (&taskEnabled, ena); }
333332};
334333
335334#endif // TASKMANAGER_IO_TASKTYPES_H
0 commit comments