Fez Touch Calibration?

I’ve just received my new FEZ Panda II and FEZ Touch. I’ve installed all the software and firmware and succesfully loaded the example Fez Touch drawing program.

When I run the program, the lines appear on the screen nowhere near where the LCD is touched. It is impossible to select colours or clear the screen.

Do I need to calibrate? If so, how? Or is it broken?

Thanks

  • rd

Did you use the tip of your nail or something pointy? This is a resestive type touch so a little direct force is required

Yes, I used a (retracted) ball point pen and my nail, but it was still a long way off - a good 5mm or so…

The calibration values and all touch drivers are in the driver source code. Take a look

Any chance of a hint where in the source code? - this is my first look at this .NET Micro! Is it normal to require this?

Is there no ineractive way of calibrating?

-rd

The source code is the file you are using in your project to use the display. The driver comes with fixed values but you can change it to add a way of calibration or simply change the calibration values manually.

If you make an interactive calibration example maybe you can share it with the community :slight_smile:

Just making sure, did you try without the film on the screen?

Yes, pulled the film off.

I see what I can find tonight. Looks like my project just got a little more complex than I was hoping!!

I’ve had another look and I suspect I have more serious problem. When I draw a straight line along the very edge of the screen, it doesn’t come out near the edge or even straight. (See image)

Can this be calibration?

Each single display will be different and will need diferent calibrartion. Some maybe more off than others.

Do not be afraid to look at source code and even change it :slight_smile: In the dirver on this page
http://code.tinyclr.com/project/277/fez-touch-lcd-component/

you will see this code

// Calibrate 
                        if (x > 3750)
                            x = 3750;
                        else if (x < 280)
                            x = 280;
 
                        if (y > 3850)
                            y = 3850;
                        else if (y < 450)
                            y = 450;
 
                        x = (3750 - x) * (240-1) / (3750 - 280);
                        y = (3850 - y) * (320-1) / (3850 - 450);

The calibration is hard coded so you can change these numbers or you can make it some application to take in calibration info dynamically.

When my Touch is the exception rather large. After some playing with the calibration constant to get to me to identify useful values​​.


 
                        int xRaw = x;
                        int yRaw = y;
// Calibrate 
/*
                        if (x > 3750)
                            x = 3750;
                        else if (x < 280)
                            x = 280;

                        if (y > 3850)
                            y = 3850;
                        else if (y < 450)
                            y = 450;

                        x = (3750 - x) * (240-1) / (3750 - 280);
                        y = (3850 - y) * (320-1) / (3850 - 450);
*/
                        if (x > 3040)
                            x = 3040;
                        else if (x < 820)
                            x = 820;

                        if (y > 3280)
                            y = 3280;
                        else if (y < 932)
                            y = 932;

                        x = (3040 - x) * (240 - 1) / (3040 - 820);
                        y = (3280 - y) * (320 - 1) / (3280 - 932);

                        Debug.Print("xRaw=" + xRaw.ToString() + " yRaw=" + yRaw.ToString() + "   x=" + x.ToString() + " y=" + y.ToString()); // debug

What puzzled me is that the last 30 lines of the screen not used by the image, while the touch still works there.

Today I dived deeper into the problem and to calibrate a test pattern, I put on the screens.


            lcd.DrawLine(0, 32, 240-1, 32, FEZ_Components.FEZTouch.Color.Black);
            lcd.DrawLine(24, 0, 24, 320-1, FEZ_Components.FEZTouch.Color.Black);
            lcd.FillRectangle(24-4 ,32-4 , 8, 8, FEZ_Components.FEZTouch.Color.Magneta);

            lcd.DrawLine(0, 288, 239, 288, FEZ_Components.FEZTouch.Color.Black);
            lcd.DrawLine(216, 0, 216, 320-1, FEZ_Components.FEZTouch.Color.Black);
            lcd.FillRectangle(216-4, 288-4, 8, 8, FEZ_Components.FEZTouch.Color.Magneta);

            lcd.DrawLine(0, 160, 240-1, 160, FEZ_Components.FEZTouch.Color.Black);
            lcd.DrawLine(120, 0, 120, 320-1, FEZ_Components.FEZTouch.Color.Black);
            lcd.FillRectangle(120- 4, 160- 4, 8, 8, FEZ_Components.FEZTouch.Color.Magneta);

Whereupon me what the problem became clearer.
The code I’ve adjusted a bit to make it easier to modify.


                        int xMin = 800;
                        int xMax = 3150;
                        int yMin = 968;
                        int yMax = 3340; 

                        if (x > xMax)
                            x = xMax;
                        else if (x < xMin)
                            x = xMin;
 
                        if (y > yMax)
                            y = yMax;
                        else if (y < yMin)
                            y = yMin;

                        x = (xMax - x) * (240 - 1) / (xMax - xMin);
                        y = (yMax - y) * (320 - 1) / (yMax - yMin);

                        Debug.Print("xRaw=" + xRaw.ToString() + " yRaw=" + yRaw.ToString() + "   x=" + x.ToString() + " y=" + y.ToString());

For a permanent calibration caliwaarden I would like to save, possibly in the registers of the display. Does anyone out there a place for?

Why not store it on the chip? You have up to 4KB there.
Take a look at the InternalFlashStorage method in GHIElectronics.NETMF.Hardware namespace.

I have a calibration program for the FEZ Touch made ​​and measurements on the display.

A video of the calibration can be seen on

Great job. Are you posting the code?

Posting of the calibration code is not a problem.
But I have the adjustments for calibration maybe not neatly into FEZ_Components_FEZTouch.cs processed.
I’m still puzzling how well the parameters can pass to this function.

The code of the Calibration program was posted, http://code.tinyclr.com/project/324/driver--fez-touch-lcd-component-expansion/
My first version was a standalone program, but the version posted is an extension of Mike’s code, leaving only one version of the driver is needed.

Great, thanks