T35 touch alignment

Hallo all.

first up huge thanks for the great community here, it has really helped a lot with my first code attempts on my new hydra.

and now to my issue… I have a T35 connected to a Hydra board and the display works fine. The only problem I am facing is that there seems to be a bit of an offset on the touch functions. I copied the Glide-4.5 keyboard example into my project and it works quite well apart from the fact that it is not always hitting the correct keys. They seem to be a bit off to the upper left side of where I press the touch screen… below are the adjustments I made to the code, but as far as I can see it looks ok… is it advised to test the touch positions, like when you calibrate a mobile device for the first time? and if so, is there any demo od how this can be achieved (I can see the bool GlideTouch.Calibrated, but no methods to Calibrate) ?

thanks in advance.



        public static Keyboard InitKeyboard()
        {
            Keyboard keyboard = new Keyboard(320, 128, 3, 32, 0);

            // Each view with keys in a up position.
            keyboard.BitmapUp = new Bitmap[4]
            {
                Resources.GetBitmap(Resources.BitmapResources.Keyboard_320x128_Uppercase),
                Resources.GetBitmap(Resources.BitmapResources.Keyboard_320x128_Lowercase),
                Resources.GetBitmap(Resources.BitmapResources.Keyboard_320x128_Numbers),
                Resources.GetBitmap(Resources.BitmapResources.Keyboard_320x128_Symbols)
            };

            // We must set the default key content.

            string[][] keyContent = new string[4][];

            // Letters
            keyContent[0] = new string[10] { "q", "w", "e", "r", "t", "y", "u", "i", "o", "p" };
            keyContent[1] = new string[9] { "a", "s", "d", "f", "g", "h", "j", "k", "l" };
            keyContent[2] = new string[9] { Keyboard.ActionKey.ToggleCase, "z", "x", "c", "v", "b", "n", "m", Keyboard.ActionKey.Backspace };
            keyContent[3] = new string[5] { Keyboard.ActionKey.ToNumbers, ",", Keyboard.ActionKey.Space, ".", Keyboard.ActionKey.Return };
            keyboard.SetViewKeyContent(Keyboard.View.Letters, keyContent);

            // Numbers
            keyContent[0] = new string[10] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" };
            keyContent[1] = new string[10] { "@ ", "#", "$", "%", "&", "*", "-", "+", "(", ")" };
            keyContent[2] = new string[9] { Keyboard.ActionKey.ToSymbols, "!", "\"", "'", ":", ";", "/", "?", Keyboard.ActionKey.Backspace };
            keyContent[3] = new string[5] { Keyboard.ActionKey.ToLetters, ",", Keyboard.ActionKey.Space, ".", Keyboard.ActionKey.Return };
            keyboard.SetViewKeyContent(Keyboard.View.Numbers, keyContent);

            // Symbols
            keyContent[0] = new string[10] { "~", "`", "|", "•", "√", "π", "÷", "×", "{", "}" };
            keyContent[1] = new string[10] { Keyboard.ActionKey.Tab, "£", "¢", "€", "º", "^", "_", "=", "[", "]" };
            keyContent[2] = new string[9] { Keyboard.ActionKey.ToNumbers, "™", "®", "©", "¶", "\\", "<", ">", Keyboard.ActionKey.Backspace };
            keyContent[3] = new string[5] { Keyboard.ActionKey.ToLetters, ",", Keyboard.ActionKey.Space, ".", Keyboard.ActionKey.Return };
            keyboard.SetViewKeyContent(Keyboard.View.Symbols, keyContent);

            int[][] keyWidth = new int[4][];

            // Letters
            keyWidth[0] = new int[10] { 32, 32, 32, 32, 32, 32, 32, 32, 32, 32 };
            keyWidth[1] = new int[9] { 32, 32, 32, 32, 32, 32, 32, 32, 32 };
            keyWidth[2] = new int[9] { 48, 32, 32, 32, 32, 32, 32, 32, 48 };
            keyWidth[3] = new int[5] { 48, 32, 160, 32, 48 };

            keyboard.SetViewKeyWidth(Keyboard.View.Letters, keyWidth);

            // Numbers
            keyWidth[0] = new int[10] { 32, 32, 32, 32, 32, 32, 32, 32, 32, 32 };
            keyWidth[1] = new int[10] { 32, 32, 32, 32, 32, 32, 32, 32, 32, 32 };
            keyWidth[2] = new int[9] { 48, 32, 32, 32, 32, 32, 32, 32, 48 };
            keyWidth[3] = new int[5] { 48, 32, 160, 32, 48 };

            keyboard.SetViewKeyWidth(Keyboard.View.Numbers, keyWidth);

            // Symbols
            keyWidth[0] = new int[10] { 32, 32, 32, 32, 32, 32, 32, 32, 32, 32 };
            keyWidth[1] = new int[10] { 32, 32, 32, 32, 32, 32, 32, 32, 32, 32 };
            keyWidth[2] = new int[9] { 48, 32, 32, 32, 32, 32, 32, 32, 48 };
            keyWidth[3] = new int[5] { 48, 32, 160, 32, 48 };

            keyboard.SetViewKeyWidth(Keyboard.View.Symbols, keyWidth);

            keyboard.CalculateKeys();
            return keyboard;
        }

Hi Woolli, and welcome to the forums !

You need to run the touch alignment project to be able to reset the alignment; give me a few minutes and I’ll try to locate it, IIRC it comes with the standard netmf SDK installer.

Edit: Ok, the path is something like:

C:\Users<YourUserName>\Documents\Microsoft .NET Micro Framework 4.1\Samples\TouchCalibration

As you can see I still have the 4.1 framework, so you may need to substitute the 4.2 directory if you’re using 4.2 firmware on your board.

Cool, thanks Brett, Ill give it a shot tonight.