GithubHelp home page GithubHelp logo

touch not working about lv_port_esp32 HOT 19 CLOSED

lvgl avatar lvgl commented on June 11, 2024
touch not working

from lv_port_esp32.

Comments (19)

alen1359 avatar alen1359 commented on June 11, 2024

seems like the touch work but there is big offset between where i touch and it react

from lv_port_esp32.

alen1359 avatar alen1359 commented on June 11, 2024

if i touch top left i get x=320, y=239, if i touch top right i get x= 4, y=240, if i touch bottom left i get x=320, y=-416 (note: it is negative 416), if i touch bottom right i get x=2, y=-235

seems like need calibration, could you please help

from lv_port_esp32.

kisvegabor avatar kisvegabor commented on June 11, 2024

It seems you just need to swap the x coordinate. You can do it easily here: https://github.com/littlevgl/esp32_ili9341/blob/master/drv/xpt2046.c#L95

x = 320-x;
if( x < 0) x = 0;
if(x  > 319) x = 319;
last_x = x; 

from lv_port_esp32.

alen1359 avatar alen1359 commented on June 11, 2024

with that correction i get the following result

if i touch top left i get x=0, y=239, if i touch top right i get x= 320, y=240, if i touch bottom left i get x=0, y=-416 (note: it is negative 416), if i touch bottom right i get x=320, y=-293

here where i added:

        /*Normalize Data*/
        x = x >> 3;
        y = y >> 3;
        xpt2046_corr(&x, &y);
        xpt2046_avg(&x, &y);
		
		x = 320-x;
		if( x < 0) x = 0;
		if(x  > 319) x = 319;
		last_x = x; 

        //last_x = x;
        last_y = y;

from lv_port_esp32.

alen1359 avatar alen1359 commented on June 11, 2024

more accurate data using pen for touch

if i touch top left i get x=0, y=239, if i touch top right i get x= 320, y=240, if i touch bottom left i get x=0, y=-416 (note: it is negative 416), if i touch bottom right i get x=320, y=-416

from lv_port_esp32.

kisvegabor avatar kisvegabor commented on June 11, 2024

I see. It really still need to be calibrated.
The calibration values are here:
https://github.com/littlevgl/esp32_ili9341/blob/master/drv/xpt2046.h#L27-L32

You should try to set the MIN coordinates to 0 and MAX to 4096 to disable calibration, check the coordinates and write them as calibration values.

I forget that here you can also invert the X and/or Y coordinates if required. So the previous hack is not required.

from lv_port_esp32.

alen1359 avatar alen1359 commented on June 11, 2024

ok, if i do min=0 and max 4096 i get teh followings

#define XPT2046_X_MIN 39
#define XPT2046_Y_MIN 21
#define XPT2046_X_MAX 271
#define XPT2046_Y_MAX 226

but when i put them in my code it doesn't work still i also tried the followings but no success

#define XPT2046_X_MIN 390
#define XPT2046_Y_MIN 210
#define XPT2046_X_MAX 2710
#define XPT2046_Y_MAX 2260

Note, X invert need to be 0

thanks for all your help

from lv_port_esp32.

kisvegabor avatar kisvegabor commented on June 11, 2024

What was the problem with the first version?

from lv_port_esp32.

alen1359 avatar alen1359 commented on June 11, 2024

ok i ran it again with 0 and 4096, here are the numbers,
bottom left x=38, y=21
top left x=38, y=211
top right x=250, y=226
bottom right x= 272, y=29

if i enter these numbers in my code and compile i get the followings
#define XPT2046_X_MIN 38
#define XPT2046_Y_MIN 21
#define XPT2046_X_MAX 272
#define XPT2046_Y_MAX 226

i get

bottom left x=379, y=-4118
top left x=378, y=-333
top right x=4334, y=-33
bottom right x= 5024, y=-4081

which make no sense

from lv_port_esp32.

kisvegabor avatar kisvegabor commented on June 11, 2024

I have no idea. The correction happens here: https://github.com/littlevgl/esp32_ili9341/blob/master/drv/xpt2046.c#L116

With the parameters, you provided it should work. You can debug it using printfs to see where the miscalculation happens.

from lv_port_esp32.

alen1359 avatar alen1359 commented on June 11, 2024

i can't figure out what is going on, is it possible to recommend me a display that works with this code.

thanks,

from lv_port_esp32.

alen1359 avatar alen1359 commented on June 11, 2024

i set the invert for Y to 1 and i believe this is where the problem is, it is creating a negative number for Y

#if XPT2046_Y_INV != 0
(*y) = XPT2046_VER_RES - (*y);

from lv_port_esp32.

alen1359 avatar alen1359 commented on June 11, 2024

top left should be 0,0 or bottom left ?

from lv_port_esp32.

kisvegabor avatar kisvegabor commented on June 11, 2024

top left should be 0,0 or bottom left ?

Top-left should be (0,0).

i can't figure out what is going on

You should printf the raw and corrected data step by step to where the problem occurs.

is it possible to recommend me a display that works with this code.

Resistive TPs might be different even for the same product type.

from lv_port_esp32.

stale avatar stale commented on June 11, 2024

This issue or pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from lv_port_esp32.

C47D avatar C47D commented on June 11, 2024

I also noticed the touch isn't working, in my case when i touch the screen from right to left the red dots appear from top to bottom, when i touch the screen from bottom to top the red dots appears from right to left.

I haven't tried to log the input device output, is there a 'easy' way to do it?

Regards

from lv_port_esp32.

embeddedt avatar embeddedt commented on June 11, 2024

@C47D Use printf or something similar inside the indev_read function.

from lv_port_esp32.

C47D avatar C47D commented on June 11, 2024

Thanks, i will take a look at it.

from lv_port_esp32.

stale avatar stale commented on June 11, 2024

This issue or pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from lv_port_esp32.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.