Faster screen refresh - how?

Hi dear fellow Nextioners!

My display is a NX4832T035_011, serial baud rate set to 115200.
I am currently working on a project, in which I want to display info from games. The proof of concept worked flawlessly: That few bytes of data I tried first, appeared on screen almost instantly. Now I continued to build it further. I tiled a page full of Texts, Numbers, Pictures, Progress bars, and the display started to lag seriously. :frowning: Now when something changes in game, it feels like 0.5 - 1sec delay to refresh on the Nextion display.
Yes, I know that string based serial communication is not the fastest, but ramping up the baud rate does not help at all.
I tried to turn off auto refresh with ref_stop, and only refresh the page once at the end. It was even slower.
I even tried the reparse protocol: I packed all the data needs to be refreshed on screen into only 22 bytes long packets, and I ran a while loop on Nextion side, in the page’s PostInitialize event. In this loop I copied all the bytes from the serial buffer into the page’s components, then called a code_c to clear buffer, a doevents to refresh the page and fill up the serial buffer again. The game sent these 22 bytes in every 100ms. I wrote out the value of usize into the display to check. It constantly changed between 22 and 44. Until the buffer clearing and filling conflicted. The byte count was a totally different number, so my Nextion code could not work properly with the faulty package, usize went over the roof (1023 +), and the code failed. Only a few seconds after the start. That 100ms loop time is not the fastest speed I need. Below 50ms would be more preferable. At least.
Currently I reverted back to classic communication protocol, and I differentiate the data between important to refresh quickly, and not so important. I send the first ones more frequently, than the latter. But the final result is barely okay-ish. :sob:

Could you suggest me any advanced practices, how to cut down the screen refresh time? What is slow in Nextion, what sould I avoid?

Is there no option to send only the info wicht is changed since the last loop ?
Soort of tracking mode.
So when only some Numbers are changed in your main loop, you only send these info to the Nextion, and not all other Texts, Pictures etc…

For serial solutions, I can’t help you.

1 Like

@MdG_NL thank you! Yes, it works! It took a bit time to rewrite the code to store everything, and to decide if vales has changed or not, but the result is good enough! It seems in Nextion, the refreshing takes longer for visually larger items. (Maybe they have more pixels to calculate in a refresh.) Thank God I have some larger texts and progress bars needs to refresh quicly, but not frequently.

Thank you again for your idea!

2 Likes