0 votes
by (120 points)
Hi,

My WeatherStationColor switches automatically between screens.

It behaves like Im touching the screen permanently:

https://youtu.be/HMgcvWJVRJY

Here's a pic of the back of the board:

http://imgur.com/a/yEtfB

Thank you for your help.

1 Answer

0 votes
by (10.3k points)

Hi Arno

People seem the have different issues with the touch screen. Before I enabled that feature my life was a lot easier;-). 
Have a look at those:
https://support.squix.org/47/weather-station-color-l%C3%A4uft-nicht-richtig (first in german but then in English)
https://support.squix.org/46/weatherstation-color-touch-touch-screen-working-properly

But yours seems to be of the same or similar nature than the first link. Could you please run the follwing diagnostic program and post the output here?

#include <XPT2046_Touchscreen.h>
#include <SPI.h>

#define TOUCH_CS D3
#define TOUCH_IRQ  D4

XPT2046_Touchscreen ts(TOUCH_CS, TOUCH_IRQ);  // Param 2 - Touch IRQ Pin - interrupt enabled polling

void setup() {
  Serial.begin(115200);
  Serial.println("Start");
  ts.begin();
  while (!Serial && (millis() <= 1000));
}
int counter = 0;
void loop() {
  if (ts.touched()) {
    Serial.println();
    TS_Point p = ts.getPoint();
    Serial.print("Pressure = ");
    Serial.print(p.z);
    Serial.print(", x = ");
    Serial.print(p.x);
    Serial.print(", y = ");
    Serial.print(p.y);
    delay(30);
    counter = 0;
  } else {
    Serial.print(".");
    counter++;
    if (counter > 100) {
      Serial.println();
      counter = 0;
    }
    delay(50);
  }
}

by (120 points)
Any update on my problem? My device is unusable. Any help would be appreciated. Thank you.
by (140 points)
Hi arnovio and all...

I cant help you much, it sounds like your touch screen is broke like mine is too.
I put some built in debug info in mine to troubleshoot it, and enable/disable the touch function until I can replace it.  Basically, my problem is it returns a touch value (p.z) = 4095 weather I touch it or not.  When not touching it, the X & Y values fly all over the place.  Result of my test without touching:

319 x -10   Pressure:  4095
275 x 95   Pressure:  4095
301 x 40   Pressure:  4095
284 x 124   Pressure:  4095
310 x 0   Pressure:  4093
318 x 5   Pressure:  4095
323 x 49   Pressure:  4095
363 x 43   Pressure:  4095
763 x -291   Pressure:  4095
304 x 10   Pressure:  4095
292 x 55   Pressure:  4095
260 x 49   Pressure:  4095
312 x 16   Pressure:  4098
320 x 0   Pressure:  4098
307 x -62   Pressure:  4095
295 x 65   Pressure:  4095
297 x 60   Pressure:  4095
313 x 15   Pressure:  4097
327 x 55   Pressure:  4095

if I touch:
basically you can see when I touched the corners:
320 x 64   Pressure:  4095
316 x 0   Pressure:  4095
292 x 57   Pressure:  4095
76 x 245   Pressure:  4095
584 x -151   Pressure:  4095
101 x 219   Pressure:  4095
554 x -120   Pressure:  4095
317 x 62   Pressure:  4095
360 x 20   Pressure:  4095

So what to do?  Nothing.  I detect a "different value" because they are all different.  I was going to try to look for the values of x+y changing but that wont work.  I will have to replace the screen.  So I put an enable/disable function.  Just replace the first part of loop to this:

void loop() {

#ifdef DEBUGTOUCH      
  if (touchController.isTouched(2500) && ENABLETOUCH) {
    TS_Point p = touchController.getPoint();
    Serial.print(p.y);
    Serial.print(" x ");
    Serial.print(p.x);
    Serial.print("   Pressure:  ");
    Serial.println(p.z);
    if (p.y < 80) {
      //Jim took out because touch screen is broken
      IS_STYLE_12HR = !IS_STYLE_12HR;
    } else {
      screen = (screen + 1) % screenCount;
    }
  }
#else
  if (touchController.isTouched(500) && ENABLETOUCH) {
    TS_Point p = touchController.getPoint();
    Serial.print(p.y);
    Serial.print(" x ");
    Serial.print(p.x);
    Serial.print("   Pressure:  ");
    Serial.println(p.z);
    if (p.y < 80) {
      //Jim took out because touch screen is broken
      IS_STYLE_12HR = !IS_STYLE_12HR;
    } else {
      screen = (screen + 1) % screenCount;
    }
  }
#endif

  gfx.fillBuffer(MINI_BLACK);
 ...
...

and add these two to settings.h:
#define ENABLETOUCH true
#define DEBUGTOUCH    

after you open your serial monitor, touch it to see if your Z value changed.  IF it stays the same value like mine, you are screwed like mine.  I have no idea for a workaround, which is a shame because it partially works.

To add insult to injury, I ordered a second off Ebay.  I accidentally ordered it without touch, so be careful because they make the EXACT screen with and without touch.

To turn off the touch, and make it display a steady screen so it's at lease usable, of course just change the define line you added to this
#define ENABLETOUCH false

when and if you get another, turn it back to true, and turn off the debug by just commenting this line:
//#define DEBUGTOUCH   

Hope it can help you.

Best regards,
JimA
by (140 points)
...and small correction.  Take the 5 print statements out after the #else:
    Serial.print(p.y);
    Serial.print(" x ");
    Serial.print(p.x);
    Serial.print("   Pressure:  ");
    Serial.println(p.z);

otherwise, its pointless.  lol.  Corrected code:


void loop() {

#ifdef DEBUGTOUCH      
  if (touchController.isTouched(2500) && ENABLETOUCH) {
    TS_Point p = touchController.getPoint();
    Serial.print(p.y);
    Serial.print(" x ");
    Serial.print(p.x);
    Serial.print("   Pressure:  ");
    Serial.println(p.z);
    if (p.y < 80) {
      //Jim took out because touch screen is broken
      IS_STYLE_12HR = !IS_STYLE_12HR;
    } else {
      screen = (screen + 1) % screenCount;
    }
  }
#else
  if (touchController.isTouched(500) && ENABLETOUCH) {
    TS_Point p = touchController.getPoint();
    if (p.y < 80) {
      IS_STYLE_12HR = !IS_STYLE_12HR;
    } else {
      screen = (screen + 1) % screenCount;
    }
  }
#endif

  gfx.fillBuffer(MINI_BLACK);
 ...
...


sorry for the error.... copy pasted too quick!
good luck.  

PS...here is the link to Ebay where I bought the replacement, cheaper than AliExpress:

www.ebay.com/itm/LCD-Touch-Panel-240x320-2-4-SPI-TFT-Serial-Port-Module-With-PBC-ILI9341-5V-3-3V/291346921118
by (120 points)
Thanks jimkernsjr! My screen seems to be broken too. A new one is on the way. Merci beaucoup :)
by (140 points)
De rien!

P.S.  When you get the new screen, reupload the code, UNcommenting:
SPIFFS.remove("/calibration.txt");

Then calibrate the screen, comment it back out and reupload.  
Because of the broken screen pb, you calibrated it without calibrating it because your touch sensor was jammed down.  This drove me crazy for a while.

My new screen came the other day, and now I'm happy.  :)  

pas plus d'ecran de merde!!

Aplus!

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

https://thingpulse.com

...