Touch Screen Calibration

<< Click to Display Table of Contents >>

Navigation:  OPUS devices update manual > Additional information >

Touch Screen Calibration

Devices with a resistive touch need a calibration after an update of the user application (i.e. when the /opt folder is deleted during the update), or if the touch doesn't work as expected, anymore.

 

Calibration after Update

 

After an update that deletes the /opt folder, i.e. after the installation of a OS / user tar file through the service mode, the calibration file is deleted. Because of that the calibration is executed automatically at the first start up of the device.

 

Calibration because of bad touch performance

 

If the touch doesn't work well, it might help to re-calibrate the touch screen.

To do that, there are several ways:

 

1. From the application:
 
With Projektor/PClient, the calibration can be started using the JavaScript command startTouchscreenCalibration();
 
With CODESYS, the calibration can be started using the Driver module Driver -> System -> TSCalibrate and then in code the command TSCalibrate.Trigger();

 

2. Through deleting the calibration file
 
When the device starts up it is checked if the calibration file exists. If it doesn't, the calibration program will be executed.
So to force the calibration to be executed at start up, the calibration file can be deleted.
This can be done through the serial console.
The command to delete the file is: rm /opt/etc/pointercal
Afterwards execute the following command to restart the device: reboot
After the restart the calibration will be started.
 

3. Through the serial console
 
The calibration program can also be executed directly from the serial console, using the command ts_calibrate
However, this can be slightly problematic if another GUI application is running, because then both applications, the user application and the calibration program, will paint on the screen and it can be difficult to do the calibration properly.
To work around that, the running application should be stopped.

 
In case of PClient, use the command: /opt/etc/init.d/02_pclient stop
Then execute the calibration program: ts_calibrate
And once the calibration has finished, restart the PClient: /opt/etc/init.d/02_pclient start

 

In case of CODESYS, use the command: /opt/CoDeSysControl/Files/run stop
Then execute the calibration program: ts_calibrate
And once the calibration has finished, restart the PClient: /opt/CoDeSysControl/Files/run start
 
In case of a customer programmed C++ application, consult the vendor of the vehicle/system for the exact command.

 

Calibrating the Device

 

When the calibration is started, this will be the first screen:

 

1

 

Press the cross hair in the upper left corner once, firmly, with your thumb (NOT with a touch pen or anything else).

When this is done, the cross hair will be shown in the upper right corner:

 

2

 

Press the cross hair again, one time, with a firm thumb press, and continue like that with the cross hairs in the lower right, lower left and center.

 

If the calibration went wrong, i.e. there was a double press and the cross hair "jumped" two positions at once, repeat the calibration in one of the ways described above.

 

On the serial console, the output while running the calibration, looks like this:
 

root@rosi /$ ts_calibrate

xres = 480, yres = 272

Took 24 samples...

Top left : X = 3593 Y = 3072

Took 34 samples...

Top right : X =  476 Y = 3211

Took 36 samples...

Bot right : X =  542 Y =  657

Took 43 samples...

Bot left : X = 3633 Y =  806

Took 46 samples...

Center : X = 2075 Y = 2098

497.903076 -0.122414 -0.002674

275.258942 0.000120 -0.070859

Calibration constants: 32630576 -8022 -175 18039370 7 -4643 65536

 

Note that xres and yres will differ depending on the device that is calibrated (the example above is from an A3, for A6 it will be 800 and 480, respectively).

 

Also note that the values for X and Y and the calibration constants will differ for each device depending on each individual touch screen.

 

Testing the touch screen

 

There is also a touch screen test program installed with the Linux operating system. This can be started through the serial console with the command ts_test

Note that for this to work best the running application should be stopped as described above.

The touch screen test program can be stopped by pressing CTRL+C on the serial console.