earthlcd / ezLCD-5x

Public Repository for ezLCD-5035-RT release files system, firmware and issue reporting
https://earthlcd.com/products/ezlcd-5x?_pos=1&_sid=0927d2260&_ss=r
0 stars 1 forks source link

ez.SetButtonEvent(sButtonHandler) document concurrency issues when drawing to the screen in the handler #78

Open JacobChrist opened 1 year ago

JacobChrist commented 1 year ago

Describe the issue

In working on some example code, I have run across several display anomalies when drawing to the screen. I have decided that this is probably due to code running in the button handler that is affecting the internal X,Y global variables (Column, Row). When these variable are changed it causes confusions in the thread that is handling the main Lua loop. This issue doesn't necessarily need to be fixed in code (as it is easy to set a flag to do the updates in the main loop) but a warning should be put in the manual to inform users that they should not write to the screen in the button event. The one exception that I don't fully understand at this time is the ez.Button(id, event) call that is given in the example code in section 14.4. The comment with this code indicates that is may redraw a button, this too may cause this concurrency issue to rear its head.

Location of Issue