Ref command does not refresh


Before I start: I have searched for a topic with the same doubt without success. If one already exists, please excuse me and you can reply with the link to it, thanks.

Model: Nextion Intelligent NX1060P101_011

Sometimes, during the communication between arduino/teensy and Nextion -via RX/TX- the information lose consistency, and if I send for example “hello” or “0.045”, the Nextion ends up showing “h&llo” or “%.0$”.

Current solution:

If a button on the Nextion is pressed, it asks the arduino corner to refresh the page completely, and from the arduino it sends one by one the current value to be displayed of all the numbers, xfloat, pictures etc that the page contains. For each value sent, arduino waits to receive confirmation from the Nextion, and when it receives an Ok, it sends the next one. This works correctly: you se the errors disappear (sometimes, other errors shows up, then you refresh a second/thir time until no errors).

Solution I want to implement:

To avoid so many communications between both sides, I want to do the following: if the same Nextion button is pressed, then Nextion itself execute “ref 0” or “ref 255” to refresh the whole page without asking for anything to arduino side. Problem: The Nextion shows no evidence that it has been refreshed.

I have tried with:
ref 0
ref 255
ref obj1, ref obj2… until ref ofjN

Any suggestions?

Thank you so much

Try using the command “doevents” after your “ref” commands