Unofficial Nextion/TJC User Forum

Command sent on uart will interrupt event code, right?

I have variables whose values are tested in event code. I suspect it is not safe to edit those variables through uart because user can press a button at the wrong time, so the command sent on uart might interfere with touchevent code. It is not documented though as far as I know. I have not come across anything in the instruction set like “atomic block” or semaphores.

Hi @david,

AFAIK there are no* interrupt priorities. Meaning, your event code won‘t be interrupted by anything else. This also means that your event code can block everything else, f.ex. if you got long loops.
If you want to process anything else (f.ex. update the screen, read serial stuff, …) you need to call doevents. It is automatically called after each touch event to update the screen with whatever changes have been made during the event.
This is btw. also true for the timer events (they can be both blocked by and blocking other events) and one of the reasonswhy they may not be very previse.

* there may be interrupts that place incoming serial bytes into a buffer or timer interrupts to keep the display interface running but there are none that you‘d have to think about when coding.

Kind regards,

Hi Max,
Thank you for your answer. You are right, because otherwise there wouldn’t be doevents command. Kind regards, David

This forum is in no way affiliated with NEXTION®, ITEAD STUDIO®, TJC®, or anyone else really. All product names, logos, and brands are property of their respective owners. All company, product, and service names used in this website are for identification purposes only. Use of these names, logos, and brands does not imply endorsement from the respective rights holder(s).