sudo apt-get update
sudo apt-get upgrade
sudo reboot
sudo raspi-config
Go to Interface Options
and Enable SPI
sudo reboot
sudo nano /boot/config.txt
Add this line at the end:
dtoverlay=piscreen,speed=16000000,cs=1,penirq=25,penirq_pull=2,keep_vref_on=0,swapxy=1,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900,display_rotate=0
sudo reboot
sudo apt-get install fbi
sudo reboot
sudo nano /usr/share/X11/xorg.conf.d/99-fbturbo.conf
Change "fbdev" "/dev/fb0"
to "fbdev" "/dev/fb1"
sudo reboot
sudo nano /etc/xdg/lxsession/LXDE/touchscreen.sh
Add these lines to the file:
DISPLAY=:0 xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axes Swap' 0
DISPLAY=:0 xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axis Inversion' 1 0
Make it executable:
sudo chmod +x /etc/xdg/lxsession/LXDE/touchscreen.sh
sudo nano /etc/xdg/lxsession/LXDE/autostart
BEFORE the line @xscreensaver -no-splash
add this:
@lxterminal --command "/etc/xdg/lxsession/LXDE/touchscreen.sh"
sudo reboot