Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Display UI on Waveshare 3.5 inch TFT
#20
Waveshare display* (XPT2046) tested with Moode 7.40:

* my display is in landscape mode / upside down so technically it is rotated by 270 degrees. Please edit your configs accordingly.


Install driver / necessary packages:
Code:
git clone https://github.com/waveshare/LCD-show.git
sudo cp ./LCD-show/waveshare35a-overlay.dtb /boot/overlays/waveshare35a.dtbo
sudo cp ./LCD-show/waveshare35a-overlay.dtb /boot/overlays/

sudo dpkg -i -B ./LCD-show/xinput-calibrator_0.7.5-1_armhf.deb

sudo apt install xinput
sudo mkdir -p /etc/X11/xorg.conf.d



Edit /boot/cmdline.txt:
Code:
net.ifnames=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait fbcon=map:10 fbcon=font:ProFont6x11 logo.nologo


Edit /boot/config.txt
Code:
disable_splash=1
disable_overscan=1
hdmi_blanking=1
hdmi_force_edid_audio=1
hdmi_force_hotplug=1
dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=audio=on
#dtoverlay=disable-wifi
#dtoverlay=disable-bt

dtparam=spi=on

dtoverlay=waveshare35a,rotate=270
max_usb_current=1
config_hdmi_boost=7
hdmi_drive=1
hdmi_ignore_edid=0xa5000080
hdmi_group=2
hdmi_mode=1
hdmi_mode=87
hdmi_cvt 480 320 60 6 0 0 0
display_rotate=1

framebuffer_width=480
framebuffer_height=320
framebuffer_aspect=-1

[pi4]
max_framebuffers=2


Edit /etc/X11/xorg.conf.d/99-fbdev.conf:
Code:
Section "Device"
        Identifier      "Allwinner A10/A13 FBDEV"
        Driver          "fbdev"
        Option          "fbdev" "/dev/fb1"

        Option          "SwapbuffersWait" "true"
EndSection




In my case the touch x/y axes had to be swapped and the pointer offset had to be adjusted slightly.
Unfortunately, the usual xorg calibration configs didn't work.

So (in your home dir) edit ~/.xinitrc

Code:
# Turn off display power management
xset -dpms

# Screensaver timeout in secs or 'off' for no timeout
xset s 60

# Capture screen size
#SCREENSIZE="$(fbset -s | awk '$1 == "geometry" { print $2","$3 }')"
SCREENSIZE="480,320"

# see https://wiki.archlinux.org/title/Calibrating_Touchscreen
DISPLAY=:0 xinput set-prop "ADS7846 Touchscreen" "Coordinate Transformation Matrix" 0 1.09 -0.065  -1.09 0 1.04  0 0 1

# Launch chromium browser
# --disk-cache-dir=/dev/null
chromium-browser --app=http://localhost/ --window-size=$SCREENSIZE --window-position=0,0 --no-first-run --enable-features=OverlayScrollbar --disable-infobars --disable-session-crashed-bubble



Now your screen should work after enabling local display in moode:
[configure]->[System]->[Local UI display]
Reply


Messages In This Thread
RE: Display UI on Waveshare 3.5 inch TFT - by DocSavage - 10-01-2021, 08:47 AM

Forum Jump: