Skip to content

Instantly share code, notes, and snippets.

@ChaosBlades
Last active December 25, 2023 20:44
Show Gist options
  • Save ChaosBlades/1ff48d121fbcc263c35681e13705328b to your computer and use it in GitHub Desktop.
Save ChaosBlades/1ff48d121fbcc263c35681e13705328b to your computer and use it in GitHub Desktop.
OctoScreen Installation on Pi 3B+ w/ PiTFT Plus
Unfortunately the only way to get the screen touch coordinates calibrated correctly is to install Raspbian to get them first before installing OctoPi.
Install full Raspbian w/ GUI on the Pi.
Skip to the 'Install Touch Screen Drivers' section below and follow the steps.
Close out of any windows on the GUI
Hide the taskbar by right-clicking on the taskbar and select "Panel Settings". Click on the "Advanced" tab, and check "Minimize panel when not in use". You should now just see the wallpaper and an icon on the desktop.
SSH into the Pi
Install xtcal:
sudo apt-get install libxaw7-dev libxxf86vm-dev libxaw7-dev libxft-dev
git clone https://github.com/KurtJacobson/xtcal
cd xtcal
make
Clear the default coordinates:
DISPLAY=:0.0 xinput set-prop "stmpe-ts" 'Coordinate Transformation Matrix' 1 0 0 0 1 0 0 0 1
Run xtcal:
DISPLAY=:0.0 ~/xtcal/xtcal -geometry 720x480
Use a stylus and tap the + on the screen.
When finished it will output the coordinates in the SSH terminal.
It should look something like this:
-0.007882 -1.094303 1.033443 1.132679 0.078381 -0.170031 0 0 1
Reboot and check if you are happy with the calibration. If not re-run xtcal until you are.
Download the latest OctoPi and flash it to your SD Card
https://octoprint.org/download/
Go through Octoprint setup and check for updates then reboot the Pi
SSH into OctoPi and run the following
sudo -- sh -c 'apt-get update; apt-get upgrade -y; apt-get dist-upgrade -y; apt-get autoremove -y; apt-get autoclean -y'
sudo raspi-config
**CHANGE YOUR PASSWORD!**
sudo reboot
SSH into OctoPi
cd ~
wget https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/adafruit-pitft.sh
chmod +x adafruit-pitft.sh
sudo ./adafruit-pitft.sh
Options 4 then 3... console no, HDMI Mirror yes, reboot yes
SSH into OctoPi
sudo apt-get install libgtk-3-0 xserver-xorg xinit x11-xserver-utils
**PSU Control Version:**
wget https://github.com/michielbaird/OctoScreen/releases/download/2.5.1-psu-control/octoscreen_2.5-1_armhf.deb
**Normal Version:**
wget https://github.com/Z-Bolt/OctoScreen/releases/download/v2.5.1/octoscreen_2.5-1_armhf.deb
sudo dpkg -i octoscreen_2.5-1_armhf.deb
sudo systemctl enable octoscreen
Change the following lines in the OctoScreen config file
sudo nano /etc/octoscreen/config
OCTOSCREEN_RESOLUTION=800x533
Change the following lines in config.txt
sudo nano /boot/config.txt
framebuffer_width=800
framebuffer_height=533
hdmi_cvt 800 533 60 6 0 0 0
Create the following file and paste the below text into that file. Change the coordinates with the ones you got.
sudo nano /usr/share/X11/xorg.conf.d/20-calibration.conf
Section "InputClass"
Identifier "STMPE Touchscreen Calibration"
MatchProduct "stmpe"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
Option "TransformationMatrix" "-0.007882 -1.094303 1.033443 1.132679 0.078381 -0.170031 0 0 1"
EndSection
sudo reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment