ok, I have to say - 3 pages. all 3 have timer to go on 4th page
on the 4 is a dual stat button. Now, here I need to put a timer to return in last page;
if I was on page 2,after 2 sec that go to button on 4, then need to return back on 2, also for others pages.
that to not make more pages, who take more space...
No enhanced display.
Thank you !
to answer the free space remaining question first:
In the Status Bar of the Nextion Editor, your model shows, followed by size followed by FLASH:
The example HMI you gave was for the 3.5" Model with 16MB Flash
When you compile your project at the end it states something like:
Compile Successful! 0 Errors, 0 Warnings,File Size:109768
Subtract your File Size from your Flash Size.
16MB is 16,777,216. (though not sure 16MB Flash is exactly 16MB - should be close within a few KB)
I saw your project from the other thread - looking good.
Okay: So see the HMI attached that I modified
Removed any Page PreInitialize, PostInitialize, Touch Press and Touch Release Events
removed not used va0 from all three pages
Timer on page 0 waits 2 seconds then moves to page 1
Timer on page 1 waits 2 seconds then moves to page 0
When buttons s1/s2/s3/s4 is pressed
Pressed Event is printh 30 xx // where x is button number sent to MCU
When buttons s1/s2/s3/s4 is released
sys2=x // where x is the page to return to
page 2 // jumps to page 2
Timer on page 2 set for 5 seconds will return to calling page if nothing happens
Timer Event Code:
Dual State Relase Event
sends printh 00 70 3F to the MCU and then returns to calling page
Hope this is of help.
Pre and Post Events are in the Nextion Editor
Click on the page canvas, you will see
a Preinitialize Event, a Postinitialize Event, a Touch Event and a Release Event
In these events you can place whatever logic you need.
No need to make them, they just are there and run in the order I posted earlier.
One more, then I wait for your answers
button s1 sends an 01
button s2 sends an 02
button s3 sends an 03
button s4 sends an 04
dual-state button sends 00 70 3F? - there is an error there
In the loop the MCU will receive 01 when button s1 is pressed, but if possible to not receive the remaining from bt0 if the dualstate is not pressed.
Separating the one command into two segments makes more coding required on your MCU
1) to deal with setting up the serial the button was pushed from
2) dealing with whether or not the dual-state button is pressed or not
This possibly could be simplified by wrapping it into just one command that the MCU deals with based on the s1 button having been pressed ...
So if I understand more - I will be able to help you accomplish it.
I used code with one of my project, i am facing a problem that all values on that page restarts from zero.
why, could you please light of it and what i have to do to make all functions continues.
Page as per HMI design
If you are needing some value to persist, you must make use or Pre and Post
- when the page changes, the old is dumped, but after Pre and the new page.
When a page is not current, it is not in memory.
Nextion SRAM is 8K to 20K of which is shared with firmware
HMI portion is 3584 Bytes in Basic Models, and up to 8192 Bytes in Enhanced
its mean this function is useless for my project
how to make Pre and Post ? is there any example code
I was not able to view your youtube video, it appears it may no longer be there, or not public
Thanks got it
did you check the video, i have shared the link again
Perhaps a programming technique involving the use of variables.
Before jumping to page3, set sys2=(page#)
Then on page3 put the code to return in the button event code
As you said, i have to use Preinitialize Event, a Postinitialize Event
with this situation, how i can set the time interval
suppose i have two pages
page1 and page2
Normally, page1 is always visible and when i touch the page1 then page2 suppose to be open and then stay for some interval,
if don't touch page2 then come back to page1
if i touch the page2 then still stay and recount the time given
but with doing all this all the parameters espacially on page2 must be active or should not reset.
in page1 touch release event put the Nextion code on Nextion side
in the page2 postInitialize event put the Nextion code on Nextion side
Your design is getting weird, you do no switch back and forth on a maybe
You only respond to something with a valid reason and with purpose
- there is no mistakes, there is no maybe.
well past midnight here - tomorrow is a busy day