Nextion Display

Hi, I just joined the forum and would like to immediately address a problem that's been bugging me for a few weeks.
I'm working with a Nextion display. I've set a 90-second timeout for the display to go to sleep. When I click on the screen, it returns to the page it was viewing but doesn't refresh the displayed data. This is because Arduino doesn't know the display has woken up, and so, for example, it doesn't update the actual temperature by rereading the relevant routine. So how do I know (on the Arduino side) that the display is visible again? I couldn't find any function in the Nextion Instruction Set that allows me to know when the display has woken up. I've patched it up by forcing the display to display a dummy page when it wakes up. So, on the Arduino side, I read the current page; if it's not the one previously displayed, I run the routines to update the data.
So, does anyone know if there's a flush function that sends data from the Nextion display when it returns to the awake state?
Thank you. Best regards.
Gianni

What I often do is select the library h file, then right-click and click on Goto Definition. As long as you have done a successful compile, you will now have the library h file open read-only, and you can see what functions are available.

How are you waking it on touch? I'm guessing
thup(1)
Is that correct?
I note that it does not register a touch event, which is the root of your problem.

If you look at the instruction set it says that thup does not affect sendxy, so I would think you can enable sendxy and get a touch response on wake from touch, which your Arduino can use as a trigger for sending updated data.

How are you communicating with the Nextion:

  • My methods?
  • Seithan's Easy Nextion Library?
  • Nextion official library?
  • Something you invented yourself?

An alternative to sleep might be to dim the Nextion backlight instead, this is what I have done on mine, it goes dim, as dim as you like, but still functions.

1 Like

Hi Perry, thanks for your reply.
The screen turns back on with thup=1.
I'll try enabling sendxy to see if it works.
Communication with Nextion occurs with both the Nextion library and Seithan's EasyNex (very convenient).
I've also created some work functions that simplify the code a bit.
I also thought about reducing the screen brightness, but wouldn't that damage the device in the long run? They're getting more and more expensive.
I created a thermostat that, in addition to indicating the internal temperature and pressure, connects via the internet to the Open Weather Map website and, using the location code, provides a range of information
such as outside temperature, outside pressure, wind speed and direction, humidity level, etc.
I've included the Blynk library in the project, which allows me to read the data displayed on my phone and set the temperature and boiler on time remotely.
I'll send you some photos of my creation.
Bye
Gianni Erroi
Ps: sorry for my poor English :smiling_face_with_tear:



1 Like

With the EasyNextionLibrary you can make the page touch press event send a trigger function to let the Arduino know the Nextion is awake.

Hi. Thank you for the information. I'll try.
Bye

I don't know why you'd think that, my heating controller has been running for years without issue.

Your English is fine, I didn't notice if it's not your first language.

Thanks for the photos, nice project :slight_smile: