Replies: 5 comments 8 replies
-
That varies among ports. When the id of the Timer(id) call is omitted or -1, it iI is a soft timer, and the number is not per se limited. |
Beta Was this translation helpful? Give feedback.
-
Yes. With timers you have to look at both the hardware mechanism of the timer and the way, the callback is executed. |
Beta Was this translation helpful? Give feedback.
-
Thanks Robert. I didn't see any reference to the hard keyword in the documentation, so this is useful to know In terms of scheduled callbacks queuing up, is there any way to see the length of this queue? |
Beta Was this translation helpful? Give feedback.
-
Just out of interest I ran this as a stress test:
So, it is a 1ms timer calling a function that takes 30s to execute. I ran this for hours on an ESP32C6 without running out of memory (which I would expect it to if it was indeed adding all the callbacks to a queue), so I imagine the queuing must check if the function is already scheduled and if so it will not add a new one to the queue? |
Beta Was this translation helpful? Give feedback.
-
Yes and no. I modified your test slightly and added a print statement to machine_timer.c which every time the timer schedules the task it prints a line, and added the schedule time as argument to the scheduled function.
Here it starts. The lines
|
Beta Was this translation helpful? Give feedback.
-
Is the virtual timer in mircopython a hardware timer? Is there a limit on the number of timers created?
machine.Timer(-1)
Is there a software timer similar to rtos?
Beta Was this translation helpful? Give feedback.
All reactions