- cal = touchhandle:calibration()
- cal = touchhandle:calibration(cal)
- cal = touchhandle:calibration("clear")
SYNOPSIS
DESCRIPTION
Query or set the calibration for the touch screen. The table cal contains the fields:
xoffs | X-offset |
xscale | X scaling factor |
xyscale | Y correction scaling factor |
xmax | X display resolution |
yoffs | Y-offset |
yscale | Y scaling factor |
yxscale | X correction scaling factor |
ymax | Y display resolution |
penthr | Pen pressure threshold |
fingerthr | Finger pressure threshold |
flags | Flags indicating screen orientation |
The following piece of code shows how the calibration data is used. Assume raw_x and raw_y contain the raw data from the hardware, while screen_x and screen_y will receive the calculated result.
A touch event will indicate an event if the raw pressure value is greater than cal.penthr. In addition, it will report a finger event if the pressure is greater that cal.fingerthr. Note that the finger pressure threshold is always larger than the pen threshold.
The third form tch:calibration("clear") will clear the current calibration data. For touch screens that need a calibration to work, this immediately prompts the user to calibrate. Touch screens with a hard-wired calibration (e.g. Infrared) revert to their default.