Re4son / RPi-Tweaks

GNU General Public License v3.0
215 stars 55 forks source link

PiTFT Config for 35R doesn't set correct touch input calibration for 90 degrees #19

Open ScarlettHoefler opened 3 years ago

ScarlettHoefler commented 3 years ago

I used kalipi-tft-config just now on my Raspberry Pi 400 to set up my PiTFT Plus 480x320 3.5" resistive touch screen (on Kali).

The default rotation of 270 was upside down; changing it to 90 displayed correctly. (90 is also suggested for this screen here: https://learn.adafruit.com/adafruit-pitft-3-dot-5-touch-screen-for-raspberry-pi/easy-install-2) You could argue that either direction is fine on a regular Pi and it's just the 400 that makes it weird, of course :)

However: After setting the rotation to 90 and having it now render in the correct direction, all of my touch inputs were off by 90 degrees. I fixed this by going to /etc/X11/xorg.conf.d/99-calibration.conf and changing the values to the setting that the script currently uses for a rotation of 0, i.e.:

    # update /etc/X11/xorg.conf.d/99-calibration.conf
    info PI-TFT "Updating X11 default calibration..."
    if [ "$ROTATION" = 0 ]; then
        cat > /etc/X11/xorg.conf.d/99-calibration.conf <<EOF
Section "InputClass"
        Identifier      "calibration"
        MatchProduct    "stmpe-ts"
        Option  "Calibration"   "120 3800 200 3900"
        Option  "SwapAxes"      "0"
EndSection
EOF

After setting it to these values, the touch inputs seem to work correctly now.