Use the Micropython scheduler when handling callbacks that allocate memory

Опубликовано: 03 Ноябрь 2024
на канале: Joe Freeman: Software Craft, Org Stuff, Tech Stuff
592
14

Micropython is a simple way of writing simple Timer and Interrupt callback handlers. You have to be really careful about memory allocation and time spent in the handler. Callbacks need to be short to re-enable the interrupt quickly and let others be processed. The recommended way around those concerns is to move the callback handler into a function that is deferred to be run by the micropython.schedule().

Related
https://joe.blog.freemansoft.com/2022...
https://joe.blog.freemansoft.com/2022...
   • Working with state in Python Timer an...  
   • Running background tasks on IoT devic...  
   • Use the Micropython scheduler when ha...  
GitHub: https://github.com/freemansoft/ESP826...