0 votes
by (240 points)
I'm trying to setup a timeout to turn the backlight display off after a predetermined amount of time. The timeout works but the routine I use to re-enable the backlight (isTouched) triggers immediately after turning off the backlight so then re-enables the backlight. Any idea why this is happening. I have commented out the ESP sleep so the only thing that should happen after the sleep timeout is that the backlight LED should turn off

Thanks in advance,

Fish

2 Answers

0 votes
by (2.9k points)

It is tricky, and basically the idea of deep sleep / wake doesn't work. At least on all my tries. You can see in my fork a workaround by keeping all alive but only OLED off after timeout. Then turning on on touching lower part of the screen. Also see cxandy's sketches.

by (240 points)
What I don't understand is why isTouched, after I shut off the display and LED, always returns true?? I ended up doing pretty much the same as you and had to specify a region to ignore because the x and y returned on a false wake was pretty consistent. Shouldn't isTouched return false if the screen isn't touched?
by (300 points)
edited by
Just a thought: would it help if you drain the touch buffer before turning the backlight display off?
by (2.9k points)
I cannot get exactly your thoughts about "drain the touch buffer" , but any better solution is welcome. The touch chip+sensor layer seem to have an internal wakeup processing on first touch after inactivity timeout. See the datasheet:
http://www.buydisplay.com/download/ic/XPT2046.pdf
by (300 points)
edited by
My thought was to empty the touch buffer with dummy readings before shutting down the backlight:  while (!ts.bufferEmpty()) p = ts.getPoint();
hoping that (ts.isTouched && !ts.bufferEmpty()) as a trigger for re-enabling the backlight returns false, unless a real touch event occurs.

(I have to do something similar when using a STMPE160 touch controller + Adafruit library, otherwise it behaves unpredictably.)
0 votes
by (2.9k points)

Hi catfish, I found this thread that may explain anomalies on OLED wake up.

Touch chip seems to be sensitive on voltage dropping of 3V3 supply line.

by (240 points)
Hi lorol,

I was starting to suspect something like that, especially after reading the XPT datasheet and noticing various options to read the data out for stability. At the moment I have it working ok, not great. I used the lower screen detection (was for 12h/24 h selection) and that appears more stable. I had added a print to output the p.x and p.y after a trigger and noticed that it was always the same screen location being detected. The  p.y < 80 avoided that so it kind of working.

Now, I'm finding I have a different issue. The weatherstation appears to work properly but then I find that the current temperature stops updating after a few hours. If I reset the ESP8266 then it updates to the current conditions but a few hours later it stops updating. The time always updates correctly so I'm not sure whats going on. I'll have to dig in further.

Thanks for the info.

Welcome to ThingPulse Q&A, where you can ask questions and receive answers from other members of the community.

https://thingpulse.com

...