At the same time i have a button on page1 with touchevent activated but it doesn’t seem to work when having this code in postinitialize. My plan was to use it as a bootup screen and if you pressed the button you would enter a configuration page kind of. Is it possible to trigger buttons during postinitialize code? If so, what more do I have to do to get the touch events happening?
As @lemax said you need to include doevents within the loops because that tells the processor to check for touch inputs etc. It‘s explained in the official instruction set under 3.26 and 3.27, too. doevents is automatically called after each touch press/release event so most of the time you don‘t need to worry about it.
The screen dims up slowly, when dim=100 it changes to page2 but during the loop no touch events are registered. Iv’e ticked in Send Component ID (touch press event) on button, picture and the whole page1 but no events at all. I can add that I’m using ESPHome and get touch events on all other pages where I don’t have a loop like this configured.
As you can see I answered his post and I can’t get it to work. I’ve tried reading the documentation. In the foor loop example doevents is the only thing within the block{}
I’ve tried doing that as well but then the dimming goes really fast and I don’t see any touch events then either.
Thinking about this some more I think you should use a Timer component and put the dimming code in there. Something like
dim++
if(dim>=100)
{
timer.en=0
page 2
}
Using timers shouldn‘t mess with touch responses etc.
Kind regards,
Max
This forum is in no way affiliated with NEXTION®, ITEAD STUDIO®, TJC®, or anyone else really. All product names, logos, and brands are property of their respective owners. All company, product, and service names used in this website are for identification purposes only. Use of these names, logos, and brands does not imply endorsement from the respective rights holder(s).