Replies: 3 comments
-
It may not be clear, but there are two concepts here: There is a timer, and then there are the timer tasks it manages. It's harder to tell which you are dealing with if the code uses the
|
Beta Was this translation helpful? Give feedback.
-
Issue #70 explains that using the If so, try something like this:
It might be close to what you need. The task does not need to be canceled, but it won't do anything interesting until six hours after startup. I may be a bit confused about what you actually need. If you are only adding a task to cancel it, it's not necessary. Reserve enough capacity for it (if the default is not enough) and add the task when you need it. |
Beta Was this translation helpful? Give feedback.
-
Thanks. I understand the concepts of the timer and such. Using 0 as a "don't start" value or assuming it wouldn't work was my error. I'll have to try it to be sure, but I think the key bit I was looking for is the
e.g. being able to declare the task variables without actually starting a timer task. All the examples I found in the repo and looking through the code assume that you want the timer to start running as soon as it's created. The short version is the code needs to have a watchdog timer that can be started when a certain event occurs, but other events need to be able to cancel it when subsequent events occur. To avoid having a ridiculous monolithic function that handles everything, they're dispatched to functions that handle each event. As such, the timer needs to be declared as a static global, but (as I mentioned) I don't want it running as soon as Normally I'd do this all within FreeRTOS, but I started this as an Arduino project, and then it developed feature creep and really should have rewritten within the FreeRTOS framework, but I was lazy. And not being a C++ guy, I didn't know how do declare them with this Thanks for the help! |
Beta Was this translation helpful? Give feedback.
-
If I want to create several global timers but not have all of them running, how would one do that? E.g,
You can't actually create a timer with an expiration of 0 milliseconds, so what I've done is set it for a ridiculous amount of time, then cancel it in the
setup()
function. TheheartbeatTimer
is one I do want running when I create it.Disclaimer: Not a C++ guy, but been writing C for 40 years.
Beta Was this translation helpful? Give feedback.
All reactions