Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adafruit 3.5TFT always has the touch rotated a -90 degrees from the screen #1029

Closed
rv10guy opened this issue Sep 29, 2020 · 9 comments
Closed
Labels
support Something isn't working with the users setup

Comments

@rv10guy
Copy link

rv10guy commented Sep 29, 2020

I am attempting to setup OctoDash on a Raspberry Pi4 with the Adafruit 3.5 TFT. I am installing the drivers following the guide here https://learn.adafruit.com/adafruit-pitft-3-dot-5-touch-screen-for-raspberry-pi/overview. No matter what I do, the touchscreen ends up -90 degrees off from the touchscreen. So for example, if I want to press the upper right corner, I have to press the upper left corner and if I want to press the upper left corner I have to press the lower-left corner. It does not matter how I rotate the screen, the touch, and the display are always off by -90 degrees. I also tried the steps here https://learn.adafruit.com/adafruit-pitft-3-dot-5-touch-screen-for-raspberry-pi/faq#faq-2859093 and it did not help.

@rv10guy rv10guy added the support Something isn't working with the users setup label Sep 29, 2020
@carl1961
Copy link

@UnchartedBull
Copy link
Owner

Probably not a problem with OctoDash, but rather with your setup. Please reopen this issue if @carl1961 link doesn't work.

@sabarrett328
Copy link

@rv10guy did the link help with this issue? I have the same thing going on. When I get home I was going to try it.

@rv10guy
Copy link
Author

rv10guy commented Dec 30, 2020 via email

@KTheMan
Copy link

KTheMan commented Jan 16, 2021

Copy-pasting my response from discord, since it's more searchable here:

So, I'm definitely sure the touch is working correctly out of the box and it is Adafruit's installer script missing something. You can run ts_calibration then ts_test and everything is perfect upon testing but X11 (which is what I'm assuming OctoDash is using to display through) doesn't pick up on it because the installer script looks for lightdm to rotate touch on X11. Install lightdm through apt, run the installer script again, and then remove lightdm. Reboot. Voila!

I did also have lxde (without its dependencies) installed/uninstalled at the time as lightdm but I do not believe that contributed to this solution.

Tl;dr: I seem to have solved it! Install lightdm through apt, run the installer script again, and then remove lightdm. Reboot. Voila!

@sabarrett328
Copy link

hhmmm... Thanks for the info. I"ll have to try that. However.... I'm not a Linux guru by any means. I've stumbled around searching for info on lightdm, and I found the github page, however I don't see anything referring to install by apt. Could you please point me somewhere I can learn more about doing this?

thanks

@machavezg9
Copy link

If I may give my 0.2, after hours of trying it came down to doing everything in the following two links.
Follow the instructions here

Note: all code below is just a copy from the original source. Double check for mistakes or run from original source.

Install your 3.5" tft
cd ~
sudo pip3 install --upgrade adafruit-python-shell click==7.0
sudo apt-get install -y git
git clone https://github.com/adafruit/Raspberry-Pi-Installer-Scripts.git
cd Raspberry-Pi-Installer-Scripts

I ran through the interactive installation:
'sudo python3 adafruit-pitft.py'

  • Installed my PiTFT 3.5"
  • Selected [4]
  • Selected [1] for 90 deg orientation
  • No to console
  • Yes to HMDI mirror
  • Reboot

After Reboot make sure your Octodash is displayed and running in the (all touch for me was portrait but landscape gui orientation)

Now run the manual calibration here

  • Note the manual calibration might not be needed but I included this because I did run it a few times til I was able to run the touch screen test and draw accurately. (Might be able to skip this)

Want may have done all the magic.

Run X Calibration here

Install xcal per X Calibration linked above:
sudo apt-get install libxaw7-dev libxxf86vm-dev libxaw7-dev libxft-dev
git clone https://github.com/KurtJacobson/xtcal
cd xtcal
make

Reset your display:
DISPLAY=:0.0 xinput set-prop "stmpe-ts" 'Coordinate Transformation Matrix' 1 0 0 0 1 0 0 0 1

Set your display geometry (NOTE!! YES 480x320 for PITFT, followed the "720x480" and it did not work):
DISPLAY=:0.0 xtcal/xtcal -geometry 480x320

Follow the on screen directions
Copy your new "Transformation Matrix Coordinates"

Navigate to
cd /usr/share/X11/xorg.conf.d/
List everything in drive
ls
If nothing with the name "20-calibration.conf" is listed, create this file
sudo nano 20-calibration.conf
Copy and Paste the code below (sourced from the xcal Adafruit link), make sure to replace the "TransformationMatrix" values with the ones previously recorded:

Section "InputClass"
        Identifier "STMPE Touchscreen Calibration"
        MatchProduct "stmpe"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
        Option "TransformationMatrix" "-0.000087 1.094214 -0.028826 -1.091711 -0.004364 1.057821 0 0 1"
EndSection

Reboot your Pi
Hopefully it worked!

@h3llb3nt
Copy link

h3llb3nt commented Apr 21, 2021

@KTheMan little workaround at the end of their post worked for me. which was to install lightdm, rerun the "installation script" and then remove lightdm.

I wasn't sure what "installation script" referred to and guessed it meant the Adafruit install script for the PiTFT. my octopi image only hadn't had octodash installed at all yet so I did the following:

I installed lightdm and after a reboot, sure enough, the touch input was off 90 degrees.
next, via ssh I reinstalled the PiTFT using adafruits' script and rebooted. when lightdm came up touch input was correct!
I installed octodash using the auto installer script and waited, and when the gui came up the touch input was working properly!
next (instead of backing up my sdcard like I should have) I uninstalled lightdm via 'apt remove lightdm' and held my breath... and input is still working correctly!

that was a difficult 3 days.

@BorkStick
Copy link

BorkStick commented May 6, 2021

Tried the @KTheMan fix and it did the trick.

I was goin off the troubleshooting page on the wiki and was also confused by the "installation script" referred to. Unlike @h3llb3nt I was thinking it was referring to the octodash script, and spent way longer than I would have like to figure out it was referring to the adafruit install script

Can we tweak the wiki section for this issue so it reads adafruit installer script, instead of installer script

https://github.com/UnchartedBull/OctoDash/wiki/Troubleshooting#touchscreen-is-rotated-adafruit-displays

Fix
Install lightdm through apt, run the adafruit installer script again, and then remove lightdm. Reboot. Thanks to @KTheMan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Something isn't working with the users setup
Projects
None yet
Development

No branches or pull requests

8 participants