Feature Request: Ability to turn off direct text to screen

GTT TFT Support

Moderator: Mods

Post Reply
mpetty
LCD Geek
Posts: 25
Joined: Mon Jul 26, 2010 10:31 am

Feature Request: Ability to turn off direct text to screen

Post by mpetty »

I think that the feature where you just send ASCII to the display and it displays it is a good feature.

But I would like the ability to turn it off.

Whenever I leave my application running for 4+ hours (of continuous updatemultiplebargraph commands at 5Hz), I end up with jumbled text on the screen.

My commands appear right; the bargraphs always update, and the application can run for thousands and thousands and of writes without an issue, but eventually there's a hiccup somewhere and a bunch of random stuff prints out to the screen. I'd like a mode where it wouldn't write things to the screen in case of bit error/firmware/software hiccups (or whatever is happening here).

Clark
Matrix Orbital
Matrix Orbital
Posts: 881
Joined: Fri Aug 17, 2007 10:58 am
Location: Matrix Orbital
Contact:

Post by Clark »

Hi Mike,

In older displays we offered the ability to lock out certain settings or text from updating the display, but these really just ignore the underlying problem; something is going wrong in communication. I understand we have explored the possibility of continuing the legacy here, but with the reporting power of the GTT it should be possible to find and handle the cause of these problems.

That said I understand finding the source of this problem won't be easy. With a 4KB buffer and flow control (I'm assuming this is activated on your end as I know you've been reading back from the display) a lot of information needs to travel to the GTT to force an error. I would recommend throwing long strings of data using the Echo command, and possibly experimenting with lower baud rates to learn more about where the error occurs and why.

However, as a possible work around, one of my colleagues suggested creating and loading a blank font; try deselecting all the options in the font generation window. Again, it would be great to know what is causing the error, but if time is short you may be able to load up this font when text is not desired to sidestep it for now.

Thanks,
~Troy
Troy Clark
Design & Development
Matrix Orbital

mpetty
LCD Geek
Posts: 25
Joined: Mon Jul 26, 2010 10:31 am

Post by mpetty »

Clark wrote:Hi Mike,

In older displays we offered the ability to lock out certain settings or text from updating the display, but these really just ignore the underlying problem; something is going wrong in communication. I understand we have explored the possibility of continuing the legacy here, but with the reporting power of the GTT it should be possible to find and handle the cause of these problems.

That said I understand finding the source of this problem won't be easy. With a 4KB buffer and flow control (I'm assuming this is activated on your end as I know you've been reading back from the display) a lot of information needs to travel to the GTT to force an error. I would recommend throwing long strings of data using the Echo command, and possibly experimenting with lower baud rates to learn more about where the error occurs and why.

However, as a possible work around, one of my colleagues suggested creating and loading a blank font; try deselecting all the options in the font generation window. Again, it would be great to know what is causing the error, but if time is short you may be able to load up this font when text is not desired to sidestep it for now.

Thanks,
~Troy
I set the text insertion window off the screen, and have disabled scrolling, so it just doesn't show. Inelegant, but that's how workarounds are :)

The USB cable I was using is pretty thin and long, so I'm testing with a better cable. You'd think that bit errors should be so low as to be a non-issue though.

A black font wouldn't work, since it will invariably overwrite some line that I'm not redrawing on every update.

This is a back burner issue since I can get it not to show up, and it only happens every 4 hours or so (and thus why it is so hard to troubleshoot!).

Sample code below. Timer is set for 200ms recurrence. If I do any more commands during the timer tick the display falls behind, so I'm just doing the one. I initially had put the value below each bar graph also, but that reduced mt to an update every couple of seconds (clear previous string with black rectangle, set insertion point, insert text) x 8 plus the update graph command takes about 5 seconds to execute, which just doesn't look pretty.

GTTDisplay is just a little wrapper that stuffs the bytes into an array and then sends out.

Code: Select all

 
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GTTDisplay;

namespace GTTTest
{
    public partial class Form1 : Form
    {
        public Display T;
        private String myStr;
        Random R;
        private int BarGraphWidth = 40;
        private int BarGraphSpacing = 60;
        private int BarGraphPadding = 10;
        private int BottomSpacing = 30;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            R = new Random();
            T = new Display(7);

            T.TouchEvent = new Display.TouchEventDelegate(ProcessTouch);

            if (T.InitializeDisplay() == false)
            {
                MessageBox.Show("booo");
            }
            T.EnableManualUpdate(true);
            T.ClearScreen();

            T.ChangeDrawingColor(Color.DarkOliveGreen);
            T.DrawLine(new Point(0, T.Height-BottomSpacing), new Point(T.Width,T.Height-BottomSpacing));

            T.ChangeTouchReportingStyle(11);
            T.SetScrollMode(1);
            T.SetTextWindow(new Point(0, 260), T.Width, T.Height);

            T.SetTextColor(Color.White);

            for (int i = 0; i < 8; i++)
            {
                T.CreateBarGraph(i, 0, 260, (i*BarGraphSpacing)+BarGraphPadding, 11, BarGraphWidth, 261-BottomSpacing, Color.Green,Color.FromArgb(18,18,55), 0);
                T.UpdateSingleBargraph(i, 260);
                T.DrawLine(new Point((i * BarGraphSpacing), 261 - BottomSpacing+11), new Point((i * BarGraphSpacing), 261 + BottomSpacing));
                T.SetTextInsertionPoint(new Point((i * BarGraphSpacing) + (int)(BarGraphWidth / 2) + (int)(BarGraphPadding / 2), 1));
                T.WriteText((i+1).ToString());

            }
            T.DrawLine(new Point(T.Width-1, 261 - BottomSpacing + 11), new Point(T.Width-1, 261 + BottomSpacing));

            T.SetTextWindow(new Point(0, 260), T.Width, T.Height);
            T.SetTextColor(Color.Blue);
            T.SetTextWindow(new Point(0, 250), T.Width, T.Height);
            T.ManualUpdate();
            T.EnableManualUpdate(false);

            timer1.Start();    

        }

        private void ProcessTouch(string type, int X, int Y)
        {
            myStr = "Type: " + type + "\nX: " + X + "\nY: " + Y;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            int[] r = new int[8];
            for (int i = 0; i < 8; i++)
            {
                r[i] = R.Next() % 260;
            }
            T.UpdateMultipleBargraphs(0, r);
            label1.Text = myStr;
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            T.ClosePort();
        }
    }
}
From the GTTDisplay class, some samples on how I'm initializing and sending the data

Code: Select all

 public bool InitializeDisplay()
        {
            mySP = new SerialPort("COM"+myPort.ToString(), 115200, Parity.None, 8, StopBits.One);
            try
            {            
                mySP.Encoding = Encoding.ASCII;
                mySP.Handshake = Handshake.RequestToSend;
                mySP.Open();
                mySP.ReceivedBytesThreshold = 9;
                mySP.DataReceived += port_OnReceiveDatazz;
                return true;
            }
            catch
            {
                return false;
            }
        }


        public void ChangeDrawingColor(Color C)
        {
            byte[] b = new byte[5];
            b[0] = 254;
            b[1] = 99;
            b[2] = C.R;
            b[3] = C.G;
            b[4] = C.B;
            mySP.Write(b, 0, b.Length);
        }
 public void CreateBarGraph(int Index,int Min, int Max,int X,int Y,int Width,int Height, Color Foreground, Color Background, int Orientation)
        {
            byte[] b = new byte[22];
            b[0] = 254;
            b[1] = 103;
            b[2] = (byte)Index;
            b[3] = BitConverter.GetBytes((short)Min)[1];
            b[4] = BitConverter.GetBytes((short)Min)[0];
            b[5] = BitConverter.GetBytes((short)Max)[1];
            b[6] = BitConverter.GetBytes((short)Max)[0];
            b[7] = BitConverter.GetBytes((short)X)[1];
            b[8] = BitConverter.GetBytes((short)X)[0];
            b[9] = BitConverter.GetBytes((short)Y)[1];
            b[10] = BitConverter.GetBytes((short)Y)[0];
            b[11] = BitConverter.GetBytes((short)Width)[1];
            b[12] = BitConverter.GetBytes((short)Width)[0];
            b[13] = BitConverter.GetBytes((short)Height)[1];
            b[14] = BitConverter.GetBytes((short)Height)[0];
            b[15] = Foreground.R;
            b[16] = Foreground.G;
            b[17] = Foreground.B;
            b[18] = Background.R;
            b[19] = Background.G;
            b[20] = Background.B;
            b[21] = (byte)Orientation;
            mySP.Write(b, 0, b.Length);
        }
        public void UpdateSingleBargraph(int Index, int Value)
        {
            byte[] b = new byte[5];
            b[0] = 254;
            b[1] = 105;
            b[2] = (byte)(Index);
            b[3] = BitConverter.GetBytes((short)Value)[1];
            b[4] = BitConverter.GetBytes((short)Value)[0];
            mySP.Write(b, 0, b.Length);
        }
        public void UpdateMultipleBargraphs(int StartIndex, int[] Values)
        {
            byte[] b = new byte[4+(Values.Length*2)];
            b[0] = 254;
            b[1] = 106;
            b[2] = (byte)(StartIndex);
            b[3] = (byte)(Values.Length);
            int i = 4;
            foreach (int Value in Values)
            {
                b[i++] = BitConverter.GetBytes((short)Value)[1];
                b[i++] = BitConverter.GetBytes((short)Value)[0];
            }
            mySP.Write(b, 0, b.Length);
        }

Ray
Matrix Orbital
Matrix Orbital
Posts: 742
Joined: Thu Dec 13, 2001 4:00 pm
Location: Earth.... I think..
Contact:

Post by Ray »

There where some bits and pieces missing but i got most of your code up and running, how long would it take on average to get the random characters on screen? (before you moved the text region out of view)

mpetty
LCD Geek
Posts: 25
Joined: Mon Jul 26, 2010 10:31 am

Post by mpetty »

Ray wrote:There where some bits and pieces missing but i got most of your code up and running, how long would it take on average to get the random characters on screen? (before you moved the text region out of view)
If I left it overnight, I'd have characters 90+% of the time. If I started it in the morning, I'd have some characters by lunchtime about 30% of the time.

If you want any more pieces of the code, I'd be happy to post them. I just didn't want to post pages upon pages of code :)

Ray
Matrix Orbital
Matrix Orbital
Posts: 742
Joined: Thu Dec 13, 2001 4:00 pm
Location: Earth.... I think..
Contact:

Post by Ray »

You can attach zip files to your posts, here's your project I'm currently testing with (not the cleanest thing but hey it does the job).
Attachments
CustomerApp1.zip
(19.3 KiB) Downloaded 578 times

Ray
Matrix Orbital
Matrix Orbital
Posts: 742
Joined: Thu Dec 13, 2001 4:00 pm
Location: Earth.... I think..
Contact:

Post by Ray »

Had it run over night sofar so good. can you validate the app i posted exhibits the problem for you?

mpetty
LCD Geek
Posts: 25
Joined: Mon Jul 26, 2010 10:31 am

Post by mpetty »

Ray wrote:Had it run over night sofar so good. can you validate the app i posted exhibits the problem for you?
I attached my code. We're mounting the displays in our enclosure now, so I won't be able to re-test probably until next week. But that's good that you're not seeing the problem. It may have been a cable problem on my end.
Attachments
GTTDisplay.zip
(84.25 KiB) Downloaded 604 times

Ray
Matrix Orbital
Matrix Orbital
Posts: 742
Joined: Thu Dec 13, 2001 4:00 pm
Location: Earth.... I think..
Contact:

Post by Ray »

Had your code running over the wekend (and yesterday since we where closed) no corruption going on.

mpetty
LCD Geek
Posts: 25
Joined: Mon Jul 26, 2010 10:31 am

Post by mpetty »

Ray wrote:Had your code running over the wekend (and yesterday since we where closed) no corruption going on.
Same here. I left it running for a number of days with no problem.

I later realized that in the lab down the hall on the days of corruption, we were hitting things with lightning and directed energy blasts. I'll just blame it on that for now.

Clark
Matrix Orbital
Matrix Orbital
Posts: 881
Joined: Fri Aug 17, 2007 10:58 am
Location: Matrix Orbital
Contact:

Post by Clark »

Hey Mike,

Further to Ray's post, Raquel and I ran our displays for a good day here with nothing out of the ordinary. I think we might have to chalk this one up to the lightning.

Thanks,
~Troy
Troy Clark
Design & Development
Matrix Orbital

Post Reply