Différences entre versions de « RASP-PiTFT-PLUS-Touch »

De MCHobby - Wiki
Sauter à la navigation Sauter à la recherche
Ligne 74 : Ligne 74 :
 
follow the directions on the screen, touching each point. Using a stylus is suggested so you get a precise touch. Don't use something metal, plastic only!
 
follow the directions on the screen, touching each point. Using a stylus is suggested so you get a precise touch. Don't use something metal, plastic only!
  
{{ADFImage|RASP-PiTFT-PLUS-Touch-30.png|640px}}
+
{{ADFImage|RASP-PiTFT-PLUS-Touch-30.png}}
  
 
{{ambox-stop|text=You should see five crosshair targets. If you see less than that, the touchscreen probably generated multiple signals for a single touch, and you should try calibrating again.}}  
 
{{ambox-stop|text=You should see five crosshair targets. If you see less than that, the touchscreen probably generated multiple signals for a single touch, and you should try calibrating again.}}  
Ligne 82 : Ligne 82 :
 
Next you can run {{fname|1=sudo TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/touchscreen ts_test}} which will let you draw-test the touch screen. Go back and re-calibrate if you feel the screen isn't precise enough!
 
Next you can run {{fname|1=sudo TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/touchscreen ts_test}} which will let you draw-test the touch screen. Go back and re-calibrate if you feel the screen isn't precise enough!
  
{{ADFImage|RASP-PiTFT-PLUS-Touch-32.png|640px}}
+
{{ADFImage|RASP-PiTFT-PLUS-Touch-32.png}}
  
 
== Calibration X ==
 
== Calibration X ==

Version du 13 juillet 2015 à 11:43


MCHobby investit du temps et de l'argent dans la réalisation de traduction et/ou documentation. C'est un travail long et fastidieux réalisé dans l'esprit Open-Source... donc gratuit et librement accessible.
SI vous aimez nos traductions et documentations ALORS aidez nous à en produire plus en achetant vos produits chez MCHobby.

Introduction

RASP-PiTFT-PLUS-Touch-01.jpg
Crédit: AdaFruit Industries www.adafruit.com

Configurer l'écran tactile

Now that the screen is working nicely, we'll take care of the touchscreen. There's just a bit of calibration to do, but it isn't hard at all.

Before we start, we'll make a udev rule for the touchscreen. That's because the eventX name of the device will change a lot and its annoying to figure out what its called depending on whether you have a keyboard or other mouse installed.

Run

sudo nano /etc/udev/rules.d/95-stmpe.rules

to create a new udev file and copy & paste the following line in:

SUBSYSTEM=="input", ATTRS{name}=="stmpe-ts", ENV{DEVNAME}=="*event*", SYMLINK+="input/touchscreen"

RASP-PiTFT-PLUS-Touch-10.png
Crédit: AdaFruit Industries www.adafruit.com

Remove and re-install the touchscreen with

sudo rmmod stmpe_ts; sudo modprobe stmpe_ts

Then type ls -l /dev/input/touchscreen It should point to eventX where X is some number, that number will be different on different setups since other keyboards/mice/USB devices will take up an event slot

RASP-PiTFT-PLUS-Touch-11.png
Crédit: AdaFruit Industries www.adafruit.com

There are some tools we can use to calibrate & debug the touchscreen. Install the "event test" and "touchscreen library" packages with

sudo apt-get install evtest tslib libts-bin 

RASP-PiTFT-PLUS-Touch-12.png
Crédit: AdaFruit Industries www.adafruit.com

Now you can use some tools such as sudo evtest /dev/input/touchscreen which will let you see touchscreen events in real time, press on the touchscreen to see the reports.

RASP-PiTFT-PLUS-Touch-13.png
Crédit: AdaFruit Industries www.adafruit.com

RASP-PiTFT-PLUS-Touch-14.png
Crédit: AdaFruit Industries www.adafruit.com

Script de calibration automatique

If you rotate the display you need to recalibrate the touchscreen to work with the new screen orientation. You can manually run the calibration processes in the next section, or you can run a small Python script which will automatically set a default touchscreen calibration based on the screen orientation.


This helper is automatically installed for you but if you'd like you can check it out here on github

Run it at the command line with sudo adafruit-pitft-touch-cal

it will try to figure out what display you have installed and the rotation it's set up for

RASP-PiTFT-PLUS-Touch-20.png
Crédit: AdaFruit Industries www.adafruit.com

By default the script will attempt to read the screen orientation by examining the PiTFT module configuration with modprobe. If the script can read the orientation it will print out the current orientation, the current touchscreen calibration values, and the new touchscreen calibration values baesd on the current orientation. Before updating the calibration the script will ask you to confirm that you'd like to make the change. Press y and enter to confirm.

RASP-PiTFT-PLUS-Touch-21.png
Crédit: AdaFruit Industries www.adafruit.com

Try using this default calibration script to easily calibrate your touchscreen display. Note that the calibration values might not be exactly right for your display, but they should be close enough for most needs. If you need the most accurate touchscreen calibration, follow the steps in the next section to manually calibrate the touchscreen.

Calibration Manuelle

If you rotate the display you have some other setup where you need to carefully calibrate you can do it 'manually'

You will want to calibrate the screen once but shouldn't have to do it more than that. We'll begin by calibrating on the command line by running

sudo TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/touchscreen ts_calibrate

follow the directions on the screen, touching each point. Using a stylus is suggested so you get a precise touch. Don't use something metal, plastic only!

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

RASP-PiTFT-PLUS-Touch-31.png
Crédit: AdaFruit Industries www.adafruit.com

Next you can run sudo TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/touchscreen ts_test which will let you draw-test the touch screen. Go back and re-calibrate if you feel the screen isn't precise enough!

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

Calibration X

You can also calibrate the X input system but you have to use a different program called xinput_calibrator.

You can do this if the calibration on the screen isnt to your liking or any time you change the rotate=XX module settings for the screen. Since the screen and touch driver are completely separated, the touchscreen doesn't auto-rotate

Normally you'd have to compile it but we have a ready to go package for you so run:

wget http://adafruit-download.s3.amazonaws.com/xinput-calibrator_0.7.5-1_armhf.deb
sudo dpkg -i -B xinput-calibrator_0.7.5-1_armhf.deb

Before you start the xinput_calibrator you will need to delete the old calibration data so run

sudo rm /etc/X11/xorg.conf.d/99-calibration.conf

Before running startx and the calibrator - otherwise it gets really confused! Now you'll have to run the xcalibrator while also running X. You can do this by startx and then opening up the terminal program and running the xinput_calibrator command (which is challenging to do on such a small screen) OR you can do what we do which is run startx in a SSH/Terminal shell and then run the xinput_calibrator from the same shell, which requires the following command order:

FRAMEBUFFER=/dev/fb1 startx &
DISPLAY=:0.0 xinput_calibrator

Follow the directions on screen:

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com


Source: Adafruit PiTFT 3.5" Touch Screen for Raspberry Pi
Créé par LadyAda pour AdaFruit Industries.

Traduction réalisée par Meurisse D pour MCHobby.be.

Toute référence, mention ou extrait de cette traduction doit être explicitement accompagné du texte suivant : «  Traduction par MCHobby (www.MCHobby.be) - Vente de kit et composants » avec un lien vers la source (donc cette page) et ce quelque soit le média utilisé.

L'utilisation commercial de la traduction (texte) et/ou réalisation, même partielle, pourrait être soumis à redevance. Dans tous les cas de figures, vous devez également obtenir l'accord du(des) détenteur initial des droits. Celui de MC Hobby s'arrêtant au travail de traduction proprement dit.

Traduit avec l'autorisation d'AdaFruit Industries - Translated with the permission from Adafruit Industries - www.adafruit.com