X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=modules%2Fdisplay_ws5inch.mk;h=c7698c786a3f66f5880137a3f88656341801efb8;hb=1333f6799890058d68551833f05f52ab3eb39489;hp=c34ea702376a8d051241785a81b26ce2a90caf18;hpb=e521876a3c21ed169f5ffc14b0f4827f25b724e5;p=blast diff --git a/modules/display_ws5inch.mk b/modules/display_ws5inch.mk index c34ea70..c7698c7 100644 --- a/modules/display_ws5inch.mk +++ b/modules/display_ws5inch.mk @@ -1,33 +1,48 @@ -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_drive=1 -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 +display_rotate=${display_rotate} 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 -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 - 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}/etc/X11/Xsession.d/" + printf 'xrandr --size 800x480\n' >"$${CFGROOT}/etc/X11/Xsession.d/10display_resolution" + # Correct DPI scaling, although application support is mediocre + mkdir -p "$${CFGROOT}/etc/X11/Xresources/" + printf 'Xft.dpi: 180\n' >"$${CFGROOT}/etc/X11/Xresources/dpi_resolution" + # Workaround for applications that do not handle DPI scaling correctly + -sed -i 's;^Exec=chromium;Exec=env GDK_DPI_SCALE=.5 chromium;' $${CFGROOT}/usr/share/applications/chromium*.desktop + -sed -i 's;^Exec=firefox;Exec=env GDK_DPI_SCALE=.5 firefox;' $${CFGROOT}/usr/share/applications/firefox*.desktop