Uasyncio sleep problem. #11236
Replies: 5 comments 2 replies
-
i think uasync sleep is far less accurate that time.sleep (scheduling overhead), in addition to this if you have a separate process running that takes say 250ms that runs while your 100ms sleep is in progress you are not getting less than 250ms sleep i suggest running anything time sensitive in a second _thread as far as i know you can only use 1 core with uasynio at this time, you can use as many _thread as you core
|
Beta Was this translation helpful? Give feedback.
-
Asyncio.sleep_ms and time.sleep_ms have similar precision. However, asyncio needs the other tasks to yield control. You may want to check, for example, how long the display update and other task take without await to yield control. Try measuring execution time of these tasks. Try inserting |
Beta Was this translation helpful? Give feedback.
-
I set the time as screen refresh rate to 500ms.
I then measured the wait in the loop for the rc servo.
I think there is more than the delay required by |
Beta Was this translation helpful? Give feedback.
-
How much does the screen refresh take? I can see the refresh frequency but don't understand what the duration of the refresh is. Also: be aware that during |
Beta Was this translation helpful? Give feedback.
-
Using await asyncio.sleep_ms(n) will produce delays ranging from n to 500 ms. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi. I have a problem with uasyncio sleep. There is a function that I activate with the button. rc servo will go back and forth at certain intervals.
await uasyncio.sleep_ms(100) is waiting more than 400ms.
the screen I use is st7735.
I put a timer step by step. Even if I write 100ms for sleep, there is a 400ms wait.
1. Yıkama frekansı : 809 ms'dir.
0 405 0 403
I tried both for 1.18 and 1.19. both have the same problem. I wonder what I am doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions