Touch Panel becomes unresponsive and Serial Camera (L2) does not work after changing the board from FEZSpider to FEZHydra

Hi,

I recently started to use my FEZSpider starter kit to try to build some mini project for my company, and I bought FEZHydra and Serial Cam L2 to use as an upgrade to the starter kit component. However, the code works in FEZSpider does not work with FEZHydra.

There are two problems,

  1. The touch panel becomes unresponsive. When using FEZSpider, the Glide button will stay pressed as long as I press it. However, with FEZHydra, it is not only hard to press the button, but the button will become “unpressed” in like 300ms (although the TapEvent will be triggered)
  2. The Serial Cam does not work after moving to FEZHydra. I found that the last block data of the picture was never sent out. I have attached a screenshot as a reference.

I am using NETMF 4.2 RTM QFE2 with the lastest GHI package (GHI NETMF v4.2 and .NET Gadgeteer Package (10-24-2012).zip)

Code attached as the following…


using System;
using System.Collections;
using System.Threading;
using GHIElectronics.NETMF.Glide;
using Gadgeteer.Interfaces;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;
using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;

namespace Gadgeteer_Multifunction
{
    public partial class Program
    {
        private byte[] picData;
        private int dataPos;

        private static GHIElectronics.NETMF.Glide.Display.Window window;


        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {
            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");

            GlideTouch.Initialize();
            window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.GlideWindow));
            Glide.FitToScreen = true;
            Glide.MainWindow = window;

            var btnSendImg = (GHIElectronics.NETMF.Glide.UI.Button)window.GetChildByName("BtnSendImg");

            btnSendImg.TapEvent += new OnTap(btnSendImg_TapEvent);

            //serCam.SetImageSize(SerCam.Camera_Resolution.SIZE_VGA);
            serCam.SetImageSize(SerCam.Camera_Resolution.SIZE_QVGA);

            //button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);

            serCam.OnDataCaptured += new SerCam.DataCapturedEventHandler(serCam_OnDataCaptured);
            serCam.StartDataCaptured += new SerCam.StartDataCapturedEventHandler(serCam_StartDataCaptured);
            serCam.FinishDataCaptured += new SerCam.FinishDataCapturedEventHandler(serCam_FinishDataCaptured);
            
            rfid.CardIDReceived += new RFID.CardIDReceivedEventHandler(rfid_CardIDReceived);
            rfid.CardIDBadChecksum += new RFID.CardIDBadChecksumEventHandler(rfid_CardIDBadChecksum);

            SetupRS232();
        }

        void SetupRS232()
        {

            rs232.Initialize(9600, Serial.SerialParity.None, Serial.SerialStopBits.One, 8, Serial.HardwareFlowControl.NotRequired);

            rs232.serialPort.Open();
        }

        void rfid_CardIDBadChecksum(RFID sender, string ID)
        {
            var txtBox = (GHIElectronics.NETMF.Glide.UI.TextBlock)window.GetChildByName("TxtRFID");
            window.FillRect(txtBox.Rect);
            txtBox.Text = "RFID (Bad Checksum): " + ID + "\n";
            txtBox.Invalidate();
        }

        void rfid_CardIDReceived(RFID sender, string ID)
        {
            var idReceived = "RFID: " + ID;
            var txtBox = (GHIElectronics.NETMF.Glide.UI.TextBlock)window.GetChildByName("TxtRFID");
            window.FillRect(txtBox.Rect);
            txtBox.Text = idReceived + "\n";
            txtBox.Invalidate();

            rs232.serialPort.Write(idReceived + "\r\n");
        }

        void btnSendImg_TapEvent(object sender)
        {
            serCam.TakePicture();
        }

        void serCam_FinishDataCaptured(SerCam sender)
        {
            var txtBox = (GHIElectronics.NETMF.Glide.UI.TextBlock)window.GetChildByName("TxtInfo");
            window.FillRect(txtBox.Rect);
            txtBox.Text = "Done!\n" + txtBox.Text;
            txtBox.Invalidate();

            var bmp = new Bitmap(picData, Bitmap.BitmapImageType.Jpeg);

            var imgBox = (GHIElectronics.NETMF.Glide.UI.Image)window.GetChildByName("ImgInfo");

            var bmpResized = new Bitmap(imgBox.Width, imgBox.Height);
            bmpResized.StretchImage(0, 0, imgBox.Width, imgBox.Height, bmp, 0, 0, bmp.Width, bmp.Height, 255);

            imgBox.Bitmap = bmpResized;
            imgBox.Invalidate();

            window.FillRect(txtBox.Rect);
            txtBox.Text = "BMP Displayed!\n" + txtBox.Text;
            txtBox.Invalidate();

        }

        void serCam_StartDataCaptured(SerCam sender, int sizeImage)
        {
            dataPos = 0;
            picData = new byte[sizeImage];

            var txtBox = (GHIElectronics.NETMF.Glide.UI.TextBlock)window.GetChildByName("TxtInfo");
            window.FillRect(txtBox.Rect);
            txtBox.Text = "Start Capture\n";
            txtBox.Invalidate();
            
        }

        void serCam_OnDataCaptured(SerCam sender, byte[] data)
        {

            Array.Copy(data, 0, picData, dataPos, data.Length);
            dataPos += data.Length;

            var txtBox = (GHIElectronics.NETMF.Glide.UI.TextBlock)window.GetChildByName("TxtInfo");
            window.FillRect(txtBox.Rect);
            txtBox.Text = data.Length + "/" + dataPos + "/" + picData.Length;
            txtBox.Invalidate();

        }

        //void button_ButtonPressed(Button sender, Button.ButtonState state)
        //{
        //    serCam.TakePicture();
        //}
    }
}


Glide Setup


<Glide Version="1.0.5">
  <Window Name="GMainWindow" Width="320" Height="240" BackColor="FFFFFF">
    <Button Name="BtnSendImg" X="19" Y="19" Width="100" Height="50" Alpha="255" Text="Send Image" Font="4" FontColor="000000" DisabledFontColor="808080" TintColor="000000" TintAmount="0"/>
    <TextBlock Name="TxtRFID" X="20" Y="138" Width="280" Height="30" Alpha="255" Text="" TextAlign="Left" TextVerticalAlign="Top" Font="4" FontColor="0" BackColor="000000" ShowBackColor="False"/>
    <TextBlock Name="TxtInfo" X="20" Y="173" Width="280" Height="60" Alpha="255" Text="" TextAlign="Left" TextVerticalAlign="Top" Font="4" FontColor="0" BackColor="000000" ShowBackColor="False"/>
    <Image Name="ImgInfo" X="141" Y="14" Width="160" Height="120" Alpha="255"/>
  </Window>
</Glide>

Hi Corona, and welcome to the forum

My suggestion would be to try to repro these two separate issues in separate apps. Ignore serial cam for a while and show touchscreen does/not work; then show serial cam does/not work. If they work individually, then it’s the interaction/integration that is causing the issue. What display do you have - that might be relevant.