Make wait_for_idle work for everyone, with busy loop or sleep loop#125
Make wait_for_idle work for everyone, with busy loop or sleep loop#125caemor merged 4 commits intorust-embedded-community:mainfrom
Conversation
|
+1 to this change. I am having issues under the esp32 platform with std, running the display inside a thread I get errors from the underlying FreeRTOS because of the busy loop: I was looking into fixing it, but I see you handled it already, thanks. |
| // - it is faster to not have it | ||
| // - it is complicated to pass the delay everywhere all the time | ||
| // - busy waiting can consume more power that delaying | ||
| // - delay waiting enables task switching on realtime OS |
There was a problem hiding this comment.
exactly what I need!, thanks
There was a problem hiding this comment.
Be careful, on esp32 you have to use delay::FreeRtos and not delay::Ets and a minimum delay_ms on 10, to make sure there is a task switch
There was a problem hiding this comment.
ah, thanks, I knew and tried delay::FreeRtos, but didn't know about the 10ms limitation.
caemor
left a comment
There was a problem hiding this comment.
I like the new change, but currently a few displays define their own wait_until_idle without using the given delay_ms. It would great to use it there as well and the case delay_ms is None fall back to a sensible constant (the current delay)
caemor
left a comment
There was a problem hiding this comment.
Thanks for the great work.
Do you think it would make sense to include the DelayUS update in here as well?
|
Fixing DelayUs touches a lot of files, I think it would be more readable in a separate PR. PR updated |
…a GetStatus Command
The delay structure is missing in many places where wait_until_idle is needed, so i added it everywhere.
Moreover, the default is to busy loop, but it can be very interesting on microcontrolers to sleep instead, either to save energy or to give time to another task. Especially with large displays where the refresh time can take several seconds. So I made the sleep time a parameter the user can control.
I also made
wait_until_idlepublic, because, even if methods call it when it is mandatory, the user can still want to call it to make sure last data has been processed before going on.