adafruit/Adafruit_TouchScreen

Avoid division by zero

fukuchi opened this issue · 0 comments

Hi,

Pressure value returned by getPoint() is always 0 in some environments. It is caused by a division-by-zero error.

138 float rtouch;
139 rtouch = z2;
140 rtouch /= z1; // = analogRead(_xm);

Here a quick hak:
140 rtouch /= (z1 + 1);