Home › Forums › Forums › Technical Support for PiScreen › [Resolved]Rotate Screen
- This topic has 8 replies, 3 voices, and was last updated 7 years, 2 months ago by Mark Williams.
- AuthorPosts
- November 20, 2014 at 4:46 am #2960aqParticipant
Hi. I’m trying to figure out how to rotate the X-Window display but I’m not sure where the configurations are. Could someone explain how?
Cheers.
November 20, 2014 at 5:24 pm #2963Mark WilliamsKeymasterRotating the display on PiScreen to portrait mode can be done within hardware;
Open /etc/modules for editing
Comment out this line by placing a ‘#’ in front of ‘flexfb’
flexfb width=320 height=480 regwidth=16 init=-1,0xb0,0x0,-1,0x11,-2,250,-1,0x3A,0x55,-1,0x36,0x28,-1,0xC2,0x44,-1,0xC5,0x00,0x00,0x0,0x0,-1,0xE0,0x0F,0x1F,0x1C,0x0C,0x0F,0x08,0x48,0x98,0x37,0x0A,0x13,0x04,0x11,0x0D,0x00,-1,0xE1,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0xE2,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0x11,-1,0X29,-3
And add this line in below
flexfb width=480 height=320 regwidth=16 init=-1,0xb0,0x0,-1,0x11,-2,250,-1,0x3A,0x55,-1,0x36,0x48,-1,0xC2,0x44,-1,0xC5,0x00,0x00,0x0,0x0,-1,0xE0,0x0F,0x1F,0x1C,0x0C,0x0F,0x08,0x48,0x98,0x37,0x0A,0x13,0x04,0x11,0x0D,0x00,-1,0xE1,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0xE2,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0x11,-1,0X29,-3
Now reboot.
If you want to change it back to landscape, un-comment the first line and comment out the second line.
If you rotate the display on the TFT, you will also need to rotate the touchscreen.
If you havent already done so, install xinput.
pi@raspberrypi ~ $ sudo apt-get install xinput -yOpen up the X init script
pi@raspberrypi ~ $ sudo nano /etc/X11/xinit/xinitrcAnd add these lines;
DISPLAY=:0 xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axes Swap' 1 DISPLAY=:0 xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axis Inversion' 1 1
before;
. /etc/X11/Xsession
You may need to change the values at the end of the each line;
Evdev Axes Swap
Swap X & Y
1 for yes and 0 for no
Evdev Axis Inversion
Swap the direction on the X or Y plane.
1 for yes and 0 for no. A number is needed for each planeYou may also need to re-calibrate the touch screen for X windows. This can be done by deleting the file below and then rebooting;
pi@raspberrypi ~ $ sudo rm /etc/pointercal.xinputMark --OzzMaker.com --
November 20, 2014 at 6:19 pm #2964aqParticipantHi Mark,
Thank you for the quick reply. I wanted it in landscape mode but flipped 180-deg. Sorry I didn’t make that clear in the previous post.
November 21, 2014 at 4:36 pm #2965Mark WilliamsKeymasterokay.
To flip it 180 degrees;pi@raspberrypi ~ $ sudo nano /etc/modulesflexfb width=320 height=480 regwidth=16 init=-1,0xb0,0x0,-1,0x11,-2,250,-1,0x3A,0x55,-1,0x36,0xE8,-1,0xC2,0x44,-1,0xC5,0x00,0x00,0x0,0x0,-1,0xE0,0x0F,0x1F,0x1C,0x0C,0x0F,0x08,0x48,0x98,0x37,0x0A,0x13,0x04,0x11,0x0D,0x00,-1,0xE1,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0xE2,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0x11,-1,0X29,-3
To match up touchscreen to new flipped display
pi@raspberrypi ~ $ sudo nano /etc/X11/xinit/xinitrcand add;
DISPLAY=:0 xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axis Inversion' 1 1
before;
. /etc/X11/Xsession
Mark --OzzMaker.com --
November 21, 2014 at 5:19 pm #2968aqParticipantAwesome ๐ Thanks a lot.
July 2, 2016 at 7:51 pm #5033azimarevParticipantI see it made to FAQ
But in fact I cannot see it working. I have RPi 3 and Piscreen1, everything works but there is no “flexfb” line in /etc/modules to comment out. If I just add the new line, it has no effect.
Has something changed now? How can I rotate my screen to be in portrait mode?
July 3, 2016 at 3:07 pm #5035Mark WilliamsKeymasterRotating the display on PiScreen to portrait mode can be done by editing /boot/config.txt and adding the optional rotation parameter after the overlay statement
dtoverlay=piscreen2r,rotate=90
The values, 0, 90, 180, 270 are supported.I have also update the FAQ page
Mark --OzzMaker.com --
July 5, 2016 at 6:08 am #5037azimarevParticipantGreat, I actually tried that first but for some reason it did not work, probably I used the wrong angle.
However, I cannot get the touchscreen to work properly. I figured out the values but it only works when I enter xinput commands in ssh, if I put it in the /etc/X11/xinit/xinitrc script, it does not work. Do you have any suggestions?
July 5, 2016 at 6:47 pm #5038Mark WilliamsKeymasterhow do you start X?
did you configure it from raspi-config?
If so, can you disable it and then see if the commands in xinitrc work when you start X from the command lineMark --OzzMaker.com --
- AuthorPosts
- You must be logged in to reply to this topic.