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

When changing screen orientation the touch points are not moving #928

Closed
silverbrewer07 opened this issue Aug 21, 2020 · 8 comments
Closed
Labels
support Something isn't working with the users setup

Comments

@silverbrewer07
Copy link

What doesn't work?
When changing screen orientation the touch points are not moving. In my case I am using a 2.8 inch screen which is natively set to be portrait at 240x320 upon rotate to landscape the ui looks good but the touch screen inputs are where the icons were originally.

What did you already try?
Tried to update the software. I've tried rotating several different ways with the same results.

General Information:
Octodash v2
Additional context
Add any other context or screenshots about the feature request here.

@silverbrewer07 silverbrewer07 added the support Something isn't working with the users setup label Aug 21, 2020
@stibabs
Copy link

stibabs commented Aug 23, 2020

Same problem...

@UnchartedBull
Copy link
Owner

I guess you need to rotate your touch input device as well (possibly recalibrate it). In some cases the touch interface doesn't get rotated if the image is rotated.

I don't have any influence on how the touch is handled, since that is all handled by Raspbian and electron.

@AdmiralMichael
Copy link

AdmiralMichael commented Aug 30, 2020

Try this:

But use lcd_rotate instead as display_rotate doesn’t rotate the touchscreen input.

@dexter323i
Copy link

dexter323i commented Sep 5, 2020

If you use a "generic" chinese display, then maybe this helps:
https://github.com/goodtft/LCD-show

@UnchartedBull
Copy link
Owner

Since there is no new activity here from OP I'm closing this. lcd_rotate should work.

@chickenwoman
Copy link

If you're using the BTT pi tft5 you need to use lcd_rotate=2 and display_rotate=2 to flip it.

@MrElie
Copy link

MrElie commented Mar 2, 2022

here is the solution for those who need it :

1st u need to go to /boot and edit config.txt
sudo nano /boot/config.txt

at the very bottom add:
display_lcd_rotate=2

Note: The angle of rotation is counted clockwise. display_lcd_rotate=0 (landscape) display_lcd_rotate=1 (90 degress) display_lcd_rotate=2 (180 degrees) display_lcd_rotate=3 (270 degrees)

Note2: I'm using the 180 degrees option in this example so change to your liking.
save and
sudo reboot now

after it reboots you will see touchscreen not responsive because we just rotated the lcd display but not the touch screen. to rotate the touchscreen simply do the following steps:
go to:
cd /usr/share/X11/xorg.conf.d

find the libinput file by doing
ls

u can now edit it will be something like:
sudo nano 40-libinput.conf

in the Section "InputClass" find the Identifier that says: "libinput touchscreencatchall" and below the line MatchIsTouchScreen "on" add the following line:
Option "TransformationMatrix" "0 1 0 -1 0 1 0 0 1"

Note1:

90° = Option "TransformationMatrix" "0 1 0 -1 0 1 0 0 1"
180° = Option "TransformationMatrix" "-1 0 1 0 -1 1 0 0 1"
270° = Option "TransformationMatrix" "0 -1 1 1 0 0 0 0 1"

Note2: Again i'm using the 180 degrees in this example change to your liking from Note1 section
Note3: The XY position of different touch screen's start point may be various, so the transformation matrix values of 90° and 270° may be the opposite. For models other than M505T, please try to adjust it yourself! This has been tested on the raspberry PI official 7 inch touchscreen.

save reboot everything should work properly
sudo reboot now

@Fish-in-a-Barrel
Copy link

Fish-in-a-Barrel commented Jul 19, 2023

These instructions don't work for Raspberry Pi 4. The /boot/config.txt options are no longer used for screen rotation.

You can use xrandr to rotate the screen, but that doesn't get persisted. Instead, you should add an X config file which defines a rotated monitor.

Go to the X config directory:
cd /usr/share/X11/xorg.conf.d

Create/edit a monitor conf file:
sudo nano 10-monitor.conf

Assuming your display resolution is 800x480, the contents of the file should be:

Section "Monitor"
    	Identifier "DSI-1"
    	Option "PreferredMode" "800x480"
    	Option "Rotate" "inverted"
EndSection

Save, then edit the libinput.conf file as described previously.

Save, reboot, and OctoDash should now be rotated on your Pi 4.


Note: the "Identifier" in monitor.conf should match the display name reported by xrandr, and this example assumes you're driving the display from the board header. If you're using HDMI, or the display names change for some reason, you can see what displays are in use with the command DISPLAY=:0 xrandr -q. The output will look something like this:

Screen 0: minimum 320 x 200, current 800 x 480, maximum 7680 x 7680
HDMI-1 disconnected primary (normal left inverted right x axis y axis)
HDMI-2 disconnected (normal left inverted right x axis y axis)
DSI-1 connected 800x480+0+0 inverted (normal left inverted right x axis y axis) 0mm x 0mm
   800x480       59.93*+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Something isn't working with the users setup
Projects
None yet
Development

No branches or pull requests

8 participants