Skip to content

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

@Hum-ID-Doan

Description

@Hum-ID-Doan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions