Issue with calibration of display (ili9341 display and xpt 2046 touch controller)

I am having a hard time calibrating the display , The example of calibration is not working as Make fails
I tried few things but I didn’t get the touch calibrated

I am running default configs with the ili9341 display and xpt 2046 touch controller res = 320x240
Didnt make any changes at all in the example sketch
example sketch - esp32+display

the issue is explained here with images
display issue

It’s okay this time, but for the record, please do not skip filling out the template - issues that don’t use the template are more likely to be ignored as they usually contain incomplete information.

I’ve updated lv_examples_component.mk. Please replace the old with the new one. Now the tpcal should work.

While running the tpcal be sure to use 0 and 4096 values in XPT2046_X/Y_MIN/MAX to work with raw, uncalibrated values during the calibration.

printscreen

Everything is default

So Updated the component.mk and the output is after function

 xpt2046_corr(&x, &y);

it does click but has offset


So this is where I am touchhing the display.
ps - I am new user so I can insert two images in one reply

Try this two steps:

#define XPT2046_X_MIN  0
#define XPT2046_Y_MIN  0
#define XPT2046_X_MAX  4095
#define XPT2046_Y_MAX  4095
  1. Run and use the tpcal app and post a screenshot.

So I followed these steps

Similary to `lv_conf.h` there is a configuration file for the examples too. It is called `lv_ex_conf.h`.
1. Copy `lv_examples/lv_ex-conf_templ.h` next to `lv_examples` directory
2. Rename is to `lv_ex_conf.h`
3. Delete the first `#if` and  last `#endif` to enable the files content
4. Enable or Disable modules

Disabled LV_USE_DEMO 0 and LV_USE_TPCAL 1
and made these changes

#define XPT2046_X_MIN  0
#define XPT2046_Y_MIN  0
#define XPT2046_X_MAX  4095
#define XPT2046_Y_MAX  4095

called this function in main.c

tpcal_create();

Gives me error :
error: implicit declaration of function ‘tpcal_create’; did you mean ‘lv_arc_create’? [-Werror=implicit-function-declaration]
tpcal_create();
^~~~~~~~~~~~
lv_arc_create

If you disable LV_USE_TPCAL then tpcal_create will probably be implicitly declared, since it’s disabled and not being compiled in. Also double-check that you included the relevant header file.

I did enable the LV_USE_TPCAL by

#define LV_USE_TPCAL       1

and disabled LV_USE_DEMO

header included in main.c is

#include "lv_examples/lv_apps/tpcal/tpcal.h"

error: implicit declaration of function ‘tpcal_create’; did you mean ‘lv_arc_create’? [-Werror=implicit-function-declaration]
tpcal_create();
^~~~~~~~~~~~
lv_arc_create

so everything is default just commented out demo_create();
and update lv_ex_conf.h (where I enabled tpcal)

Is the #if 0 at the top of lv_ex_conf.h set to #if 1?

I removed the if and endif in lv_ex_conf.h

Insert an #error statement right before #define LV_USE_TPCAL 1 and see if an error gets triggered.

It does get to error statement.

Pull the lv_examples master branch and try again; there was a bug which I’ve fixed.

1 Like

Cool ! worked
I will post the results once I get back to lab!
Thanks for helping

Here is the tpcal app

tp

Still strange. You should get larger numbers. Have you set these?

#define XPT2046_X_MIN  0
#define XPT2046_Y_MIN  0
#define XPT2046_X_MAX  4095
#define XPT2046_Y_MAX  4095

1a
sorry for the mistake I made the changes and here are the results of

#define XPT2046_X_MIN  0
#define XPT2046_Y_MIN  0
#define XPT2046_X_MAX  4095
#define XPT2046_Y_MAX  4095

I’ve checked the XPT2046 driver again and all the issue comes from xpt2046_corr tries to correct the coordinates. While running the calibration, lets skip xpt2046_corr. Just comment out xpt2046_corr(&x, &y);. Now you should get points like 100 and 3000.

pop
commented out

xpt2046_corr(&x, &y);