]> git.plutz.net Git - blast/commitdiff
introduce touchscreen rotation as variable
authorPaul Hänsch <paul@plutz.net>
Sun, 21 Jul 2019 14:45:14 +0000 (16:45 +0200)
committerPaul Hänsch <paul@plutz.net>
Sun, 21 Jul 2019 14:45:14 +0000 (16:45 +0200)
config.example
modules/display_ws5inch.mk

index 1014f1825dacae825cc5aff868d008fac47f97e2..6574d0ccb76dae4e56ecdcb68a3cccdc725385dc 100644 (file)
@@ -46,6 +46,9 @@
 ## In nodm, use full screen chromium web browser as session
 # webui=http://localhost/
 
 ## In nodm, use full screen chromium web browser as session
 # webui=http://localhost/
 
+## Rotation for some Raspberry Displays
+# display_rotate=0
+
 ## If the approxmodule is enabled, then one (and only one) apt-source
 ## can be choosen to install packages from
 ## See modules/approx.mk if you need more flexibility
 ## If the approxmodule is enabled, then one (and only one) apt-source
 ## can be choosen to install packages from
 ## See modules/approx.mk if you need more flexibility
index c34ea702376a8d051241785a81b26ce2a90caf18..ae557c9ef1f1c292e2d828cdb42c1d0395a4c2de 100644 (file)
@@ -1,6 +1,16 @@
-define display_ws5inch_boot :=
+ifndef display_rotate
+  display_rotate := 0
+endif
 
 
-# Waveshare 5 Inch Display
+ifeq "${display_rotate}" "0"
+  display_touch_calibration := 200 3950 250 4000
+else ifeq "${display_rotate}" "2"
+  display_touch_calibration := 3950 200 4000 250
+endif
+
+define RPICONFIG +=
+
+### Waveshare 5 Inch Display ###
 hdmi_group=2
 hdmi_mode=87
 hdmi_cvt=800 480 60 6 0 0 0
 hdmi_group=2
 hdmi_mode=87
 hdmi_cvt=800 480 60 6 0 0 0
@@ -9,25 +19,28 @@ dtparam=i2c_arm=on
 dtparam=spi=on
 enable_uart=1
 dtoverlay=ads7846,cs=1,penirq=25,penirq_pull=2,speed=50000,keep_vref_on=0,swapxy=0,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900
 dtparam=spi=on
 enable_uart=1
 dtoverlay=ads7846,cs=1,penirq=25,penirq_pull=2,speed=50000,keep_vref_on=0,swapxy=0,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900
+# Display is better readable from top direction
+display_rotate=${display_rotate}
 endef
 
 define display_ws5inch_cfg :=
 Section "InputClass"
        Identifier "evdev touchscreen catchall"
        MatchIsTouchscreen "on"
 endef
 
 define display_ws5inch_cfg :=
 Section "InputClass"
        Identifier "evdev touchscreen catchall"
        MatchIsTouchscreen "on"
-       Option  "Calibration"   "200 3950 250 4000"
+       Option  "Calibration"   "${display_touch_calibration}"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
 EndSection
 endef
 
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
 EndSection
 endef
 
-export display_ws5inch_boot display_ws5inch_cfg
+export display_ws5inch_cfg
 
 PACKAGES += xserver-xorg-input-evdev xinput xinput-calibrator
 
 .PHONY: _display_ws5inch
 _config: _display_ws5inch
 _display_ws5inch: ${CFGROOT} _copy _mount
 
 PACKAGES += xserver-xorg-input-evdev xinput xinput-calibrator
 
 .PHONY: _display_ws5inch
 _config: _display_ws5inch
 _display_ws5inch: ${CFGROOT} _copy _mount
-       printf '%s\n' "$${display_ws5inch_boot}" >>"$${CFGROOT}/boot/config.txt"
        mkdir -p "$${CFGROOT}/usr/share/X11/xorg.conf.d/"
        printf '%s\n' "$${display_ws5inch_cfg}" >"$${CFGROOT}/usr/share/X11/xorg.conf.d/45-evdev.conf"
        mkdir -p "$${CFGROOT}/usr/share/X11/xorg.conf.d/"
        printf '%s\n' "$${display_ws5inch_cfg}" >"$${CFGROOT}/usr/share/X11/xorg.conf.d/45-evdev.conf"
+       mkdir -p "$${CFGROOT}/etc/X11/Xsession.d/"
+       printf 'xrandr --size 800x480\n' >"$${CFGROOT}/etc/X11/Xsession.d/10display_resolution"