Problem with Sending/Displaying Animation to GLK240128-25

LK/ELK/VK/PK/OK/MX/GLK/EGLK/GVK/GLT Series

Moderators: Henry, Mods

Post Reply
sheetsjf
LCD?
Posts: 6
Joined: Wed Feb 19, 2014 11:40 am

Problem with Sending/Displaying Animation to GLK240128-25

Post by sheetsjf » Thu May 15, 2014 3:15 pm

I am working on a GLK240128-25 display with firmware version 8.4. I can successfully upload and display bitmaps, but I am having trouble getting animations to work.
Here is a portion of the C# code I am using to upload a simple animation:

Code: Select all

       public bool UploadEightPointOneAnimation(UInt16 id, UInt32 size, LinkedList<byte> data)
        {
            float completion = 1;
            int percentage = 0;
            float dataLength = data.Count();
            Write(254, 92, 4); //Animation upload command
            Write(id);      //Animation ID, 2 bytes
            Write(size);    //Animation size, 4 bytes, LSB first

             if ((byte)Read() != 1)  //Check that file will fit
                return false;
            foreach (byte element in data)   //Begin upload protocol (non-Xmodem)
            {
                percentage = (int)((completion / dataLength) * 100);

                Console.Write("\r{0}% ", percentage);
                completion = completion + 1;

                Write(element);
                if ((byte)Read() == element)
                    Write(1);   //Confirm echo matches transmitted data
                else
                {
                    Write(8);   //Abort upload for display and host if echo does not match
                    return false;
                }
            }
            return true;
        }

And this is the code which contains the Animation data:

Code: Select all

  
public static void HardCodedAnimation(Display display)
    {
        UInt16 FileID = 25;
        UInt32 size = 67; //Total bytes of animationFile
        float dataLength = 0;
        LinkedList<byte> AnimationData = new LinkedList<byte>(new byte[0]);

       //ANIMATION DATA BYTES
        Console.WriteLine("Populating AnimationData List");

        AnimationData.AddLast(9);//Total Frames
        AnimationData.AddLast(0);//Total Frames

        AnimationData.AddLast(41);//Offsets1 (Frame 1 header is the 41st byte in the list)
        AnimationData.AddLast(0);//Offsets1
        AnimationData.AddLast(0);//Offsets1
        AnimationData.AddLast(0);//Offsets1

        AnimationData.AddLast(44);//Offsets2 (Frame 2 header is the 44th byte in the list)
        AnimationData.AddLast(0);//Offsets2
        AnimationData.AddLast(0);//Offsets2
        AnimationData.AddLast(0);//Offsets2

        AnimationData.AddLast(47);//Offsets3
        AnimationData.AddLast(0);//Offsets3
        AnimationData.AddLast(0);//Offsets3
        AnimationData.AddLast(0);//Offsets3

        AnimationData.AddLast(50);//Offsets4
        AnimationData.AddLast(0);//Offsets4
        AnimationData.AddLast(0);//Offsets4
        AnimationData.AddLast(0);//Offsets4

        AnimationData.AddLast(53);//Offsets5
        AnimationData.AddLast(0);//Offsets5
        AnimationData.AddLast(0);//Offsets5
        AnimationData.AddLast(0);//Offsets5

        AnimationData.AddLast(56);//Offsets6
        AnimationData.AddLast(0);//Offsets6
        AnimationData.AddLast(0);//Offsets6
        AnimationData.AddLast(0);//Offsets6

        AnimationData.AddLast(59);//Offsets7
        AnimationData.AddLast(0);//Offsets7
        AnimationData.AddLast(0);//Offsets7
        AnimationData.AddLast(0);//Offsets7

        AnimationData.AddLast(62);//Offsets8
        AnimationData.AddLast(0);//Offsets8
        AnimationData.AddLast(0);//Offsets8
        AnimationData.AddLast(0);//Offsets8

        AnimationData.AddLast(65);//Offsets9
        AnimationData.AddLast(0);//Offsets9
        AnimationData.AddLast(0);//Offsets9
        AnimationData.AddLast(0);//Offsets9

        AnimationData.AddLast(5);//Times1
        AnimationData.AddLast(0);//Times1

        AnimationData.AddLast(8);//Header1 X
        AnimationData.AddLast(1);//Header1 Y
        AnimationData.AddLast(255);//Bitmap1

        AnimationData.AddLast(8);//Header2 X
        AnimationData.AddLast(1);//Header2 Y
        AnimationData.AddLast(254);//Bitmap2

        AnimationData.AddLast(8);//Header3 X
        AnimationData.AddLast(1);//Header3 Y
        AnimationData.AddLast(252);//Bitmap3

        AnimationData.AddLast(8);//Header4 X
        AnimationData.AddLast(1);//Header4 Y
        AnimationData.AddLast(248);//Bitmap4

        AnimationData.AddLast(8);//Header5 X
        AnimationData.AddLast(1);//Header5 Y
        AnimationData.AddLast(240);//Bitmap5

        AnimationData.AddLast(8);//Header6 X
        AnimationData.AddLast(1);//Header6 Y
        AnimationData.AddLast(224);//Bitmap6

        AnimationData.AddLast(8);//Header7 X
        AnimationData.AddLast(1);//Header7 Y
        AnimationData.AddLast(192);//Bitmap7

        AnimationData.AddLast(8);//Header8 X
        AnimationData.AddLast(1);//Header8 Y
        AnimationData.AddLast(128);//Bitmap8

        AnimationData.AddLast(8);//Header9 X
        AnimationData.AddLast(1);//Header9 Y
        AnimationData.AddLast(0);//Bitmap9

        dataLength = AnimationData.Count();

        Console.WriteLine("AnimationData filled with {0} nodes", dataLength);

       if( display.UploadEightPointOneAnimation(FileID, size, AnimationData))
       Console.WriteLine("Success!");
       else
       Console.WriteLine("Upload Failed");



       //DISPLAY ANIMATION
        display.Write(254, 193, (byte)FileID, 200, 100);
        display.Write(254, 194, (byte)FileID, 1);
        Console.WriteLine("Play animation command sent!!");
    }

I formatted the animation file this way based on what the manual said, and the code is excecuting, but the animation is not playing.
GLX240128-25 (Rev2.1) Manual
Page 36

Animation File Format:

Total Frames = Two bytes representing the total number of frames in the animation
Offsets = One entry for each frame, 4 bytes indicating the start of the bitmap file.
Times = Two bytes for each frame representing the length of time (100ms) for which it is displayed.
Header 1 = Two bytes, one representing the width and one the height of the first bitmap.
Bitmap 1 Data = The first bitmap data, as per the Bitmap File Creation example.

Header 9 = Two bytes, one representing the width and one the height of the last bitmap.
Bitmap 9 Data = The last bitmap data, as per the Bitmap File Creation example.

Tino
Matrix Orbital
Matrix Orbital
Posts: 158
Joined: Wed May 22, 2013 9:04 am
Location: Matrix Orbital

Re: Problem with Sending/Displaying Animation to GLK240128-2

Post by Tino » Fri May 16, 2014 10:52 am

Hi,

I see a couple things in you code setting up the animation data.

You are missing the Times for eight of the bitmaps that are being uploaded.
You need to have a Time in for each bitmap that is being displayed.

Next you will need to update the Offsets after the Times are added into your code.

Please let me know if this helped the issue.
Thank you
Martino
Martino DeLeon
Matrix Orbital
Technical Support Representative

sheetsjf
LCD?
Posts: 6
Joined: Wed Feb 19, 2014 11:40 am

Re: Problem with Sending/Displaying Animation to GLK240128-2

Post by sheetsjf » Fri May 16, 2014 12:33 pm

I still can't seem to get my animation to run. Here is my updated Animation data code:

Code: Select all

 public static void HardCodedAnimation(Display display)
    {
        UInt16 FileID = 25;
        UInt32 size = 83; //Total bytes of animationFile
        float dataLength = 0;
        LinkedList<byte> AnimationData = new LinkedList<byte>(new byte[0]);

       //ANIMATION DATA
        Console.WriteLine("Populating AnimationData List");
        AnimationData.AddLast(9);//Total Frames
        AnimationData.AddLast(0);//Total Frames

        AnimationData.AddLast(57);//Offsets1 (Frame 1 header is the 57th byte in the list)
        AnimationData.AddLast(0);//Offsets1
        AnimationData.AddLast(0);//Offsets1
        AnimationData.AddLast(0);//Offsets1

        AnimationData.AddLast(60);//Offsets2 (Frame 2 header is the 60th byte in the list)
        AnimationData.AddLast(0);//Offsets2
        AnimationData.AddLast(0);//Offsets2
        AnimationData.AddLast(0);//Offsets2

        AnimationData.AddLast(63);//Offsets3
        AnimationData.AddLast(0);//Offsets3
        AnimationData.AddLast(0);//Offsets3
        AnimationData.AddLast(0);//Offsets3

        AnimationData.AddLast(66);//Offsets4
        AnimationData.AddLast(0);//Offsets4
        AnimationData.AddLast(0);//Offsets4
        AnimationData.AddLast(0);//Offsets4

        AnimationData.AddLast(69);//Offsets5
        AnimationData.AddLast(0);//Offsets5
        AnimationData.AddLast(0);//Offsets5
        AnimationData.AddLast(0);//Offsets5

        AnimationData.AddLast(72);//Offsets6
        AnimationData.AddLast(0);//Offsets6
        AnimationData.AddLast(0);//Offsets6
        AnimationData.AddLast(0);//Offsets6

        AnimationData.AddLast(75);//Offsets7
        AnimationData.AddLast(0);//Offsets7
        AnimationData.AddLast(0);//Offsets7
        AnimationData.AddLast(0);//Offsets7

        AnimationData.AddLast(78);//Offsets8
        AnimationData.AddLast(0);//Offsets8
        AnimationData.AddLast(0);//Offsets8
        AnimationData.AddLast(0);//Offsets8

        AnimationData.AddLast(81);//Offsets9
        AnimationData.AddLast(0);//Offsets9
        AnimationData.AddLast(0);//Offsets9
        AnimationData.AddLast(0);//Offsets9

        AnimationData.AddLast(5);//Times1
        AnimationData.AddLast(0);//Times1

        AnimationData.AddLast(5);//Times2
        AnimationData.AddLast(0);//Times2

        AnimationData.AddLast(5);//Times3
        AnimationData.AddLast(0);//Times3

        AnimationData.AddLast(5);//Times4
        AnimationData.AddLast(0);//Times4

        AnimationData.AddLast(5);//Times5
        AnimationData.AddLast(0);//Times5

        AnimationData.AddLast(5);//Times6
        AnimationData.AddLast(0);//Times6

        AnimationData.AddLast(5);//Times7
        AnimationData.AddLast(0);//Times7

        AnimationData.AddLast(5);//Times8
        AnimationData.AddLast(0);//Times8

        AnimationData.AddLast(5);//Times9
        AnimationData.AddLast(0);//Times9

        AnimationData.AddLast(8);//Header1
        AnimationData.AddLast(1);//Header1
        AnimationData.AddLast(255);//Bitmap1

        AnimationData.AddLast(8);//Header2
        AnimationData.AddLast(1);//Header2
        AnimationData.AddLast(254);//Bitmap2

        AnimationData.AddLast(8);//Header3
        AnimationData.AddLast(1);//Header3
        AnimationData.AddLast(252);//Bitmap3

        AnimationData.AddLast(8);//Header4
        AnimationData.AddLast(1);//Header4
        AnimationData.AddLast(248);//Bitmap4

        AnimationData.AddLast(8);//Header5
        AnimationData.AddLast(1);//Header5
        AnimationData.AddLast(240);//Bitmap5

        AnimationData.AddLast(8);//Header6
        AnimationData.AddLast(1);//Header6
        AnimationData.AddLast(224);//Bitmap6

        AnimationData.AddLast(8);//Header7
        AnimationData.AddLast(1);//Header7
        AnimationData.AddLast(192);//Bitmap7

        AnimationData.AddLast(8);//Header8
        AnimationData.AddLast(1);//Header8
        AnimationData.AddLast(128);//Bitmap8

        AnimationData.AddLast(8);//Header9
        AnimationData.AddLast(1);//Header9
        AnimationData.AddLast(0);//Bitmap9

        dataLength = AnimationData.Count();

        Console.WriteLine("AnimationData filled with {0} nodes", dataLength);

       if( display.UploadEightPointOneAnimation(FileID, size, AnimationData))
       Console.WriteLine("Success!");




       //DISPLAY ANIMATION
        display.Write(254, 193, 25, 0, 0);
        display.Write(254, 194, 25, 1);
        Console.WriteLine("Play animation command sent!!");
    }
In case this code is unclear my intention is to make an animation beginning with an 8 x 1 grid of pixles lit in frame 1, then 7 x 1, 6 x 1, and so on, turning off pixles from right to left until all pixles are off in the final frame of the animation. The only reason I am making this animation is so I can get a concrete understanding of how animations are meant to be formatted, so I can create larger, more complex animations in the future.

All help is greatly appreciated. Thanks!

Jason

Tino
Matrix Orbital
Matrix Orbital
Posts: 158
Joined: Wed May 22, 2013 9:04 am
Location: Matrix Orbital

Re: Problem with Sending/Displaying Animation to GLK240128-2

Post by Tino » Fri May 16, 2014 3:11 pm

Hi Jason,

Your code is correct.

There is only one thing. Your ID is too high. The manual is incorrect and I will be forwarding this information to have the manual corrected.

For the Animation you are limited to use IDs 0-16.
Also you are limited to 32 frames per animation.

I apologize for any inconvenience and confusion this may have caused.
Also I would like to thank you for bringing this to our attention.
Thank you
Martino
Martino DeLeon
Matrix Orbital
Technical Support Representative

sheetsjf
LCD?
Posts: 6
Joined: Wed Feb 19, 2014 11:40 am

Re: Problem with Sending/Displaying Animation to GLK240128-2

Post by sheetsjf » Thu Jun 19, 2014 11:01 am

I have gotten my animation working just fine, and I would like to thank you for your help on that. I am now working on loading some scripts to the display, however I am having some trouble getting scripts with an ID > 255 to be displayed. I am wondering if I have run into a similar problem with the scripts as I did with the animations. The display documentation indicates that any ID between 0 and 1023 should be valid, but I have not found this to be the case.

Tino
Matrix Orbital
Matrix Orbital
Posts: 158
Joined: Wed May 22, 2013 9:04 am
Location: Matrix Orbital

Re: Problem with Sending/Displaying Animation to GLK240128-2

Post by Tino » Thu Jun 19, 2014 3:07 pm

Hi Jason,

How are you sending the "Upload Script File" to the display? If you could post an example that could help with figuring out the issue you are having.

The ID of the script value should be between 0 -1023. I've tested 255 and it works for me. So maybe it could be how you are sending the script data for the ID 255.

Is this the only Script that isn't working for you properly?

Thank you
Martino
Martino DeLeon
Matrix Orbital
Technical Support Representative

sheetsjf
LCD?
Posts: 6
Joined: Wed Feb 19, 2014 11:40 am

Re: Problem with Sending/Displaying Animation to GLK240128-2

Post by sheetsjf » Fri Jun 20, 2014 7:42 am

I am currently uploading scripts to the display through Mogd Sharps "Script Display" feature.
I am creating .mts files that begin with the "Upload Script File" command bytes (254 92 2 ID Length Data), and then I use the File Transfer protocol to upload the desired script
Here is a sample .mts file which uploads a script of ID 200. The script should (and does, for me) draw a rectangle at 187, 100, 236, 116

Code: Select all

SendNumeric 254 92 2 200 0 7 0 0 0
ReadByteCompare 1
SendNumeric 254
ReadByteCompare 254
SendNumeric 1
SendNumeric 114
ReadByteCompare 114
SendNumeric 1
SendNumeric 1
ReadByteCompare 1
SendNumeric 1
SendNumeric 187
ReadByteCompare 187
SendNumeric 1
SendNumeric 100
ReadByteCompare 100
SendNumeric 1
SendNumeric 236
ReadByteCompare 236
SendNumeric 1
SendNumeric 116
ReadByteCompare 116
SendNumeric 1
This is a sample of a .mts file which uploads the same script as before, only to ID = 44 1, or 300 in decimal (I think).

Code: Select all

SendNumeric 254 92 2 44 1 7 0 0 0
ReadByteCompare 1
SendNumeric 254
ReadByteCompare 254
SendNumeric 1
SendNumeric 114
ReadByteCompare 114
SendNumeric 1
SendNumeric 1
ReadByteCompare 1
SendNumeric 1
SendNumeric 187
ReadByteCompare 187
SendNumeric 1
SendNumeric 100
ReadByteCompare 100
SendNumeric 1
SendNumeric 236
ReadByteCompare 236
SendNumeric 1
SendNumeric 116
ReadByteCompare 116
SendNumeric 1
Finally, when i step through this .mts file to test the scripts, the rectangle draws when the first script is called, the screen clears, and the rectangle is not drawn again.

Code: Select all

SendNumeric 254 93 200 0
SendNumeric 254 88
SendNumeric 254 93 44 1
It is possible that I am formatting the bytes for the ID incorrectly, but I have tried a few different configurations, and cannot seem to get it to work.

Thanks in advance for your help,

Jason

Tino
Matrix Orbital
Matrix Orbital
Posts: 158
Joined: Wed May 22, 2013 9:04 am
Location: Matrix Orbital

Re: Problem with Sending/Displaying Animation to GLK240128-2

Post by Tino » Fri Jun 20, 2014 2:31 pm

Hi Jason,
First I'd like to thank you for bringing this issue to our attention and posting this to our forums.

You are not doing anything wrong in your commands. But you have come across a bug that I have forwarded on to have corrected in the next firmware release.

Unfortunately there is no work around this bug so for the moment please only use ID values between 0 and 255.

I apologize for any inconvenience this may have caused.
Thank you again from bringing another issue to our attention.
Regards,
Martino
Martino DeLeon
Matrix Orbital
Technical Support Representative

Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests