Glide Touch stops working after about 30 minutes on FEZ Raptor and T43 LCD

Using the NETMF 4.2 SDK, Glide, and a GHI T43 display, I created a display with buttons and text boxes. All the event handlers are called ok for about 30 minutes, then touch stops working until I reboot the board. Any suggestions?

The first thing i would try is a simple program to see of it still stops.

I had the same issue with a G120 where it worked after boot and stops within a few minutes in my case. I put it down to the processing of the Zigbee serial data that was every second because if I disabled Zigbee the touch kept working.

Check your code for anything that may doing a lot of background processing.

I am not sure how GHI handle the ADC for the touch and if this is down in the idle process but somehow if your code has a heavy processing load, it seems to affect the touch response.

Thanks for the response. Yes I have some background processing, my code has to scan and debounce key presses from a GHI KP16 keypad, polling each key every 10 milliseconds. Also there are continuous data messages coming and going to the ethernet port via the Socket class and a rs232 port (via an rs232 event handler). But why should the touch function completely stop? It should simply slow down, become less responsive. It does not recover until reboot. There must be a bug somewhere. Can you suggest what .NETMF software module I should look at to try to make a fix? Is this problem the same as discussed in this post:
“Fez Raptor Glide touch problems”
https://www.ghielectronics.com/community/forum/topic?id=15360&page=1#msg153954

?

I am still having problems with the touch screen. I am using Glide. About one every 15 reboots, the touch screen does not respond to touch forever. Is there something wrong with the way I am initializing Glide? I found that Glide must be initialized in the ProgramStarted function so initialize happens in the correct thread. Is there some secret as to how Glide and the touch screen must be initialized?

Calling new KioskTouchScreen() initializes Glide from Program.cs:


 /// <summary>
        ///This method is run when the mainboard is powered up or reset.    
        /// </summary>
        void ProgramStarted()
        {
            /*******************************************************************************************
            Modules added in the Program.gadgeteer designer view are used by typing 
            their name followed by a period, e.g.  button.  or  camera.
            
            Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
                button.ButtonPressed +=<tab><tab>
            
            If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
                GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
                timer.Tick +=<tab><tab>
                timer.Start();
            *******************************************************************************************/

            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.

            try
            {
                //Initialize the Glide touch screen user interface object
                TouchScreenServer = new KioskTouchScreen();

                StartEvent = new AutoResetEvent(false);
                if (System.Diagnostics.Debugger.IsAttached)
                    StartTimer = 3;
                else
                    StartTimer = 5;
                DelayStartTimer = new GT.Timer(1000, GT.Timer.BehaviorType.RunContinuously); // every second (1000ms)
                DelayStartTimer.Tick += new GT.Timer.TickEventHandler(DelayStartTimer_Tick);
                DelayStartTimer.Start();


                ThreadStart starter = new ThreadStart(ProcessCommandsLoop);
                Thread th = new Thread(starter);
                th.Start();
            }
            catch (Exception ex)
            {
                KioskUtilities.LogException("ProgramStarted() exception", ex);
                KioskUtilities.Reboot();
            }
        }

Here is the KioskTouchScreen class constructor:


   public KioskTouchScreen()
        {
            //This code must run on the main Gadgeteer dispatching thread
            Debug.Print("Initializing Glide GUI Framework");
            GlideTouch.Initialize();
            CalibrateDisplays.CalibrateT43Display();
            GlideTouch.TouchDownEvent += new TouchEventHandler(GlideTouch_TouchDownEvent);
            Glide.Keyboard.TapKeyEvent += new OnTapKey(Keyboard_TapKeyEvent);
        }

The T43 display must be calibrated for touch coordinates in the CalibrateT43Display function:


 public static class CalibrateDisplays
    {
      
        /// <summary>
        /// Set touch calibration points for T43 display 
        /// The touch coordinates must line up with the display coordinates
        /// </summary>
        public static void CalibrateT43Display()
        {
            if (GlideTouch.CalSettings == null)
            {
                CalibrationSettings oCalSettings = new CalibrationSettings();
                const int CAL_POINTS = 5;
                 
                //These numbers were determined by hours of trial and error
                short[] sx = new short[CAL_POINTS] { 240, 48, 48, 432, 432 };
                short[] sy = new short[CAL_POINTS] { 136, 26, 246, 246, 26 };
                short[] cx = new short[CAL_POINTS] { 478, 140, 142, 817, 828 };
                short[] cy = new short[CAL_POINTS] { 462, 202, 785, 721, 168 };

                Point[] Points = new Point[CAL_POINTS];
                Points[0] = new Point(240, 136);
                Points[1] = new Point(48, 26);
                Points[2] = new Point(48, 246);
                Points[3] = new Point(432, 246);
                Points[4] = new Point(432, 26);
                oCalSettings.CX = cx;
                oCalSettings.CY = cy;
                oCalSettings.SX = sx;
                oCalSettings.SY = sy;
                oCalSettings.Points = Points;
                Touch.ActiveTouchPanel.SetCalibration(CAL_POINTS, sx, sy, cx, cy);
                GlideTouch.CalSettings = oCalSettings;
            }
        }
    }

@ dspacek - Your initialization code works fine. I would first try the buttons example on https://www.ghielectronics.com/docs/315/glide and see if it shows the issue as well.