I have a Nextion 7 inch enhance type display. I have enabled sleep using thsp = 120 and thup = 1 line of code. Now display become sleep mode after 2min, if there is no any touch event.

But, this sleeping is completely turn off the display.

I have several pages and I want to reset to a specific page, if there is no any touch event in any page instead of sleep function.

Greatly appreciate if someone can give a solution for this.


I solved the problem using a Nextion timer. (tm0)

I got a timer and change tim value. ( unfortunately Nexion allow to maximum to 65535mS). vscope should be globle, otherwise you cant use timer in every page.

I reset the timer in page touch event. In timer event I put this code.

if(tm0.tim==60000) //reset time in mS
   page 0 //specific page to load

The Nextion screen has a command for this. It is called wup and defines the id of page that the screen should go to on wake from sleep. The default is set to 255, which means that the display wakes up on the page it was on before the sleep event.

16 wup Wake Up
 Page wup=2, n0.val=wup 
Sets which page Nextion loads when exiting sleep mode
 min is 0, max is # of last page in HMI, or default 255
 When wup=255 (not set to any existing page)
– Nextion wakes up to current page, refreshing components only
 wup can be set even when Nextion is in sleep mode 
  • Thanks for your answer. But, I want to sleep to a specific page. Not wake up. wup sets wake up page. Not sleep page. – user_fs10 Oct 1 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.