prenticedavid/MCUFRIEND_kbv

Uno ESP32 - Can't get button_simple to work

sparx266 opened this issue · 1 comments

Hello

I'm having trouble getting the button_simple example to work with this library.
I'm using a 2.4" parallel shield type display.
Calibrating on an UNO gives this result:

*** COPY-PASTE from Serial Terminal:
const int XP=6,XM=A2,YP=A1,YM=7; //240x320 ID=0x9341
const int TS_LEFT=200,TS_RT=917,TS_TOP=188,TS_BOT=922;

PORTRAIT CALIBRATION 240 x 320
x = map(p.x, LEFT=200, RT=917, 0, 240)
y = map(p.y, TOP=188, BOT=922, 0, 320)

LANDSCAPE CALIBRATION 320 x 240
x = map(p.y, LEFT=188, RT=922, 0, 320)
y = map(p.x, TOP=917, BOT=200, 0, 240)

Calibrating on the ESP32 UNO gives this:

*** COPY-PASTE from Serial Terminal:
const int XP=6,XM=A2,YP=A1,YM=7; //240x320 ID=0x9341
const int TS_LEFT=199,TS_RT=921,TS_TOP=183,TS_BOT=910;

PORTRAIT CALIBRATION 240 x 320
x = map(p.x, LEFT=199, RT=921, 0, 240)
y = map(p.y, TOP=183, BOT=910, 0, 320)

LANDSCAPE CALIBRATION 320 x 240
x = map(p.y, LEFT=183, RT=910, 0, 320)
y = map(p.x, TOP=921, BOT=199, 0, 240)

I can draw using ESP32Test Touch from the s60sc forked version of the touchscreen library but the display seems reversed.

Any ideas what is going wrong?

Thank you.

Bear in mind that ESP32 does not have pre-defined Dnn and Ann pins. When you use pinMode() you use the appropriate GPIOnn numbers. e.g. D6 on Uno is GPIO27 on ESP32.
This is a comparison between Uno and ESP32 on one specific Shield.

//MCUFRIEND_kbv ID=0x9488  320 x 480      Red 3.95 inch XXXX_Calibration
const int XP=6,XM=A2,YP=A1,YM=7; //320x480 ID=0x9488
const int TS_LEFT=851,TS_RT=140,TS_TOP=704,TS_BOT=66;

//MCUFRIEND_kbv ID=0x9488  320 x 480      Red 3.95 on ESP32
const int XP=27,XM=15,YP=4,YM=14; //320x480 ID=0x9488
const int TS_LEFT=858,TS_RT=105,TS_TOP=923,TS_BOT=13;

Note that Adafruit's TouchScreen.h does not work very well on ESP32.
You should find that TouchScreen_kbv.h is "better" but not perfect.

David.