Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WaveshareTouchScreen::normalizeTsPoint( TSPoint &p, uint8_t rotation) #13

Open
tdoan95 opened this issue Sep 19, 2022 · 1 comment
Open

Comments

@tdoan95
Copy link

tdoan95 commented Sep 19, 2022

The normalizeTsPoint-function is not working properly.

InTouchTest.ino I always wondered why you have to change back to "Waveshield.setRotation(0);"
Turns out the coordinates wouldn't fit if left at "Waveshield.setRotation(1);"

So the TouchTest.ino only works if you set your text horizontally at rotation = 1 and to draw you set back rotation = 0

And ONLY then it will work like this. Like you can't set rotation = 0, write vertical and then change to rotation = 1 to draw. The fillCircle-dots will be off-set and mirrored.

After some troubleshooting I found out normalizeTsPoint-function is the culprit. Please correct me if I'm wrong, I'm still learning. I changed the last part of the function to this:

int16_t t;
switch (rotation)
{
case 0:
break;

case 1:
t = p.y;
p.y = LCD_WIDTH - 1 - p.x;
p.x = t;
break;

case 2:
p.y = LCD_HEIGHT - 1 - p.y;
p.x = LCD_WIDTH - 1 - p.x;
break;

case 3:
t = p.y;
p.y = p.x;
p.x = LCD_HEIGHT - 1 - t;
break;
}

This solved the problem for me but I'm not sure if it is really solved or just superficial solved.

@MikeTosen
Copy link

Fantastic - I can confirm - this solved the problem.

Thanks for posting this, saved me allot of headaches

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants