树莓派屏幕旋转的两种方法

2018-02-04  本文已影响0人  被代码捆住腿的摄影师

标题中的两种方法,实际是对应两种情况。之所以存在两种情况,原因在于现在的(2018.2.4)的raspbian之中,存在一个实验性质的openGL驱动,该驱动能够提供更好的图形性能,但是暂时还不稳定。以后这个驱动稳定之后,可能就会替换现有的GL驱动了,也就不存在两种情况了。


所以要旋转你的树莓派屏幕之前,首先要看你的树莓派用的是哪种显示驱动:

sudo raspi-config 

打开树莓派的设置,进入Advanced Options - GL Driver

查看目前正在用哪种驱动,不同版本的raspbian的目录稍有差别,自己看就好了。

情况一:使用的是实验版的openGL驱动:

使用 xrandr  命令来旋转屏幕

xrandr -o left     to rotate to the left

xrandr -o right     to rotate to the right

xrandr -o normal     to go back to a normal screen

xrandr -o inverted     to flip the screen upside down

注意:这个命令的效果是一次性的,重启之后就会恢复正常。

情况二:使用传统的驱动

修改启动配置文件

sudo nano /boot/config.txt

添加以下的某一行:

display_rotate=0           不旋转 Normal 

display_rotate=1           转90 degrees 

display_rotate=2           转180 degrees 

display_rotate=3           转270 degrees 

display_rotate=0x10000        左右翻转horizontal flip 

display_rotate=0x20000        上下翻转vertical flip 

注意:这个方法的效果是永久的。

上一篇下一篇

猜你喜欢

热点阅读