Calibrate Glide Touch

I’m trying to use this code that I found in a post on the forum to set calibration for my 7 inch display:


public static void InitTouch()
{
	Glide.FitToScreen = true;
	GlideTouch.Initialize();

	const int CAL_POINTS = 5;
	short[] sx = new short[CAL_POINTS] { 400, 80, 80, 720, 720 };
	short[] sy = new short[CAL_POINTS] { 240, 48, 432, 432, 48 };
	short[] cx = new short[CAL_POINTS] { 510, 159, 160, 846, 855 };
	short[] cy = new short[CAL_POINTS] { 494, 233, 765, 754, 236 };

	Microsoft.SPOT.Touch.Touch.ActiveTouchPanel.SetCalibration(CAL_POINTS, sx, sy, cx, cy);
}

This line fails to compile, indicating that Microsoft.SPOT.Touch.Touch doesn’t exist.

Microsoft.SPOT.Touch.Touch.ActiveTouchPanel.SetCalibration ...

I included this reference:

using Microsoft.SPOT.Native;

And this using statement:

using Microsoft.SPOT.Touch;

Never mind :-[

I just figured out that I also need to add this reference:

using Microsoft.SPOT.Touch;

Sorry for the 8-month bump, but I’m having a hard time understanding how the calibration code works; in particular all the values for sx, sy, cx, & cy confuse me.
I’m trying to use this as an example for a T43 module for which I need to correct the calibration. Can somebody explain what this code’s doing? (And should I start a new thread?)

@ okinawanspud - The calibration example on https://www.ghielectronics.com/docs/162/touch#3186 might also help.

The four parameters are a mapping essentially. NETMF starts by giving you four screen coordinates. Say your screen is 800x480. It will likely give you coordinates at (10,10); (790,10); (10, 470); (790, 470); and (400,240). You’ll note that those points are near the four corners and the center. Your program can then draw those four spots on the screen and wait for a touch to occur at each spot. This is usually done in order since you can’t rely on the uncalibrated touch points. In other words, draw a mark in the center, wait for a touch and record it, draw a mark in the corner, wait for a touch, and so on. After that process you have five touch points that correspond to the five screen coordinates. Using the above five coordinates, the touch hardware might actually report (210, 112); (1200, 113); (211, 600); (1205, 608); and (695, 360) at the spots where you touched. Those are obviously outside the range of the screen size. So, you’ll give those points and the points given to you to start back NETMF and it will then scale the reported hardware values to fit in the screen size before it reports them to you.

sx and sy are the screen coordinates and cx and cy are the points reported by the hardware during calibration.