Perhaps we should consider making drawWidgets actually only queue up a redraw, so if it gets called >1 time before we next idle there is only ever one full redraw?
One call will not be enough when at least one widget changes it's width during draw. But we can do with one or two draws, first draw executed instantly and then capture all other drawWidgets and queue one for next idle. I have tried it and it works fine.
The changes to the 4 widgets are working well, I could remove about half of the code of widgetupdate while keeping it working the same way. It now essentially only handles automatically hiding of the widgets and the queuing of drawWidgets
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
One call will not be enough when at least one widget changes it's width during draw. But we can do with one or two draws, first draw executed instantly and then capture all other
drawWidgets
and queue one for next idle. I have tried it and it works fine.The changes to the 4 widgets are working well, I could remove about half of the code of
widgetupdate
while keeping it working the same way. It now essentially only handles automatically hiding of the widgets and the queuing ofdrawWidgets