Announcement

Collapse
No announcement yet.

Keyboard Object Question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Eran
    replied
    Hi Tim,

    In ViSi-Genie Magic, you may make a routine to allow your program to set an initial value of the contrast. You can do this by setting the CONTRAST on the Pre-Genie Init.

    Example:
    Code:
    gfx_Contrast(1);
    Hope this helps and Best Regards,

    Leave a comment:


  • Bigtim
    replied
    Cant seem to upload the video but if its ok here is a link


    https://www.dropbox.com/s/2vq3d5jxm3...95447.mp4?dl=0

    Leave a comment:


  • Bigtim
    replied
    Hi eran

    sorry another dumb question. On power up is the display contrast setting always set to 15?

    is there a way to change this and have it default to a lower value? Or better still load a value from static memory that i can control.


    i ask because my partner has suddenly developed an issue where the screen wont boot properly and reliably and he is convinced it is a power problem.

    i will try and upload a short video of what he is seeing

    Leave a comment:


  • Eran
    replied
    Hi Tim,

    I’m not sure if my comprehension of your problem is right, but maybe it can help you.
    I am assuming that you’re asking why the exact string is printed in your Strings even though you didn’t put any NULL terminator at all.

    I went through your code and noticed that you’re doing the following:
    Code:
    for (j:=0; j<maxEditLength;j++)                // populate the edit strings with the data
                    editStringOne[j]:=recString[j];
                    editStringTwo[j]:=recString[j+maxEditLength];
                    editStringThr[j]:=recString[j+(2*(maxEditLength))];
                    editStringFou[j]:=recString[j+(3*(maxEditLength))];
                    editStringFiv[j]:=recString[j+(4*(maxEditLength))];
    next
    This is from your MagicCode0 lines 52 to 59. I also found that maxEditLength = LABEL_LENGTH = 5.

    From here, you can see that you’re limiting your Strings to only display five characters(j<maxEditLength) from 0 to 4. This is the reason why you don’t need any NULL terminator at all.
    0 = none(space)
    1 = verse
    2 = solo(space)
    3 = intro
    5 = chord

    Which came from your array:
    char label_list[] = "none versesolo introchordpitchlead…”

    To prove that it is what’s making your code work, you may change LABEL_LENGTH to value 6 in line 7 of your MagicCode2(variables) and notice that your five Strings will have six characters per string already.

    Hope I have been of some help and Best Regards,

    Leave a comment:


  • Bigtim
    replied
    Thanks Eran, that does make sense and explains most of what I am seeing. Its certainty not a problem to punctuate the strings I create for printing with NULL terminators.

    The only remaining 'weird' thing is that one of my messages (I call it Label List text) is string essentially of 5 character bytes and is sent something like this "none versesolo introchord" ie no punctuation. This is deconstructed in magicObject0 (lines50-58) then printed to form 12 by MagicEvent5 (lines 24-28) without any NULL character punctuation and in a lot of cases (as the example above) without even any spaces. Maybe this is pure luck and the 'unused' elements of my strings (eg editStringOne) are holding some remnant spaces or NULL characters which make it look like its working?

    Leave a comment:


  • Eran
    replied
    Hi Tim,

    Based on your setup, the NULL Characters are needed as a pause for printing between the elements of the array. Without the NULL in the action_type[] array, the printing of the elements won’t have any pause at all and will print continuously just like what you’re experiencing.

    As you have noticed in printing the action_list[] elements, no other element is printed after your desired elements. The reason for this is because of your array’s elements. You constructed your array in such a way that spaces will serve as black spaces in your printing. You may test it further with this altered array:

    Code:
    char action_list[] = "Action1  000           11111Action2             21222Action3             31333Action4             41444Action5             51555Action6             61666Action7             71777Action8             81888Action9             11999Action10            11000";

    Hope this cleared your question and Best Regards,

    Leave a comment:


  • Bigtim
    replied
    Apologies for my terrible Arduino script and inability to programme anything resembling decent string handling, this is not the important bit for me, luckily my development partner is much more skilled.


    In the project, the data receipt is done in MagicObject0 as is the decoding into the five arrays that will hold the five individual pieces of data.

    Originally I was issuing another MagicBytes message from within this MagicObject (basically the data for this list box comes as two messages) I thought that this might be the problem so I commented this out (line 84 of MagicObject0) and set a flag to send the message from the main loop using a silly flag called 'trythis'
    This had no effect but I forgot to remove it before I uploaded the file.


    The drawing of the listbox is done in MagicEvent3

    I put a big comment with your name on it around the NULL characters which make all the difference in the Arduino sketch down towards the bottom of the file



    Attached Files
    Last edited by Bigtim; 25th September 2018, 08:56 AM.

    Leave a comment:


  • Bigtim
    replied
    Hi Eran, I have a good one for you today

    As you might remember my project is using the 4D touch screen to interact with an Arduino.

    So much of my code is built around sending a message to the Arduino, getting a response from the host, then allow the user to see and edit the content of this response before sending any updated data back to the Arduino in another message.

    All this messaging is done using magic bytes messages.

    Depending on what data I want from the Arduino I send different 'codes' within my magic bytes message and the Arduino returns the appropriate data. For the most part this data is ascii text data.

    Because I am using a list box type approach, The messages coming back usually contain 5 items worth of data. Depending on what data I am looking for the length of the response can vary. For example one message may ask for a particular list of data each element having 5 bytes of data, the next message may request data elements that each have 25 characters.

    So far so good. All my magic bytes messages are working and I use a message header to work out what data is coming back and decode it appropriately.

    I start by storing it in an array as below.

    Code:
    func rMagicObject0(var action, var object, var newVal, var *ptr)
    
        var i,j,recD1,recD2,recD3;
    
        recCmd := ptr[0];
        recSubCmd := ptr[1];
        recD1 :=ptr[2];
        recD2 :=ptr[3];
        recD3 :=ptr[4];
        dataStart :=0;
        dataStart := recD1 << 8;
        dataStart := dataStart | recD2;
        dataEnd := recD3;
    
        for (i:=5; i<newVal;i++)
    
            recString[i-5] :=ptr[i];
    
        next
    
        serout(ACK);
    So after my 5 message header bytes, I store the rest of the message in an array called recString

    The depending on the type of data I split it up into five discrete arrays as below:

    Code:
            if (recSubCmd == ACTION_LIST_TYPE)                     // We are looking at action list data
    
                 for (j:=0; j < ACTION_TYPE_LENGTH ;j++)               // populate the edit strings with the data
                    editStringSix[j]:=recString[j];
                    editStringSev[j]:=recString[j+ACTION_TYPE_LENGTH];
                    editStringEig[j]:=recString[j+(2*(ACTION_TYPE_LENGTH))];
                    editStringNin[j]:=recString[j+(3*(ACTION_TYPE_LENGTH))];
                    editStringTen[j]:=recString[j+(4*(ACTION_TYPE_LENGTH))];
                next
    I then jump to another screen and populate some string objects with these individual strings:

    Code:
      
        PrintStrings(37, editStringSix, 1) ;       // Print the action type names we are looking at
        PrintStrings(38, editStringSev, 1) ;
        PrintStrings(39, editStringEig, 1) ;
        PrintStrings(40, editStringNin, 1) ;
        PrintStrings(41, editStringTen, 1) ;
    The string of bytes I am sending from the Arduino contain 5 header 'command bytes' followed by the correct number of ascii characters depending on the data that has been requested. I DO NOT insert a NULL character between the individual elements within the body of the message, but I do terminate the message with a NULL character

    Up until today this has all worked fine, but today something odd happened. I have added a new message type and am receiving my 5 header bytes correctly followed by five sets of 25 character data (in the example above ACTION_TYPE_LENGTH is a constant of 25.

    However when I execute the print strings commands, in strings object 37, the display is printing all 125 characters of the original message, object 38 prints 100 characters, object 39 prints 75 characters and so on until object 41 prints just the last 25 characters.

    The picture below shows what I get:

    Click image for larger version  Name:	incorrect.jpg Views:	4 Size:	2.11 MB ID:	65443

    Sorry the image is terrible basically in the list box which has 5 items, the first column is correct, he second column Action1, Action2 etc is correct

    The third column which should contain five messages each of 25 characters is exhibiting the problem.

    This is how it should appear:

    Click image for larger version

Name:	image_3243.jpg
Views:	19
Size:	1.75 MB
ID:	65441

    In the incorrect picture you might be able to spot that message 1 contains all 125 bytes, message 2 starts correctly but contains 100bytes etc.

    Now to get it to appear correctly what did was insert a NULL character in between the five 25 character elements of the message.

    What is strange is that the Action names shown above Action1, Action2 etc do not seem to need this NULL character and they are printing correctly using identical code to the examples above.

    Does that make sense? I will post the code and my Arduino sketch (its getting a bit big now and my Arduino code is definitely a hack because I am simply simulating what my development partner will ultimately write proper code to talk to the screen)

    Unless I made a real cockup, the only thing that is different between the code that is handling the receipt, dissection and printing of the text that makes up column 2 (which works) compared to column 3 (which doesn't work without the NULL characters) is the number of characters in each data element (20 vs 25)
    Last edited by Bigtim; 25th September 2018, 08:46 AM.

    Leave a comment:


  • Eran
    replied
    Hi Tim,

    No Worries. It's our pleasure to help our customers in need.
    Congratulations on building such a great project!

    All the best,

    Leave a comment:


  • Bigtim
    replied
    Eran, we fixed it today. So sorry to have wasted your time. Turned out to be an error in his code which is doubly irritating since he told me he had the problem having loaded my sketch which clearly he hadn't done!. So sorry for the wild goose chase but thank you again for the amazing support.

    Leave a comment:


  • Eran
    replied
    Hi Tim,

    I have conducted a few more tests and didn’t encounter the same issue as your partner had. For testing, I made a Genie Project with Maximum String Length of 100. Can you try running the code using Program Loader on your end and on your partner’s?

    If this runs without error on his then the String Length isn’t the issue that he’s having.

    NOTE: You may need to recompile this and change into your display type.

    Best Regards,
    Attached Files

    Leave a comment:


  • Bigtim
    replied
    No worries Eran, thanks for the feedback! We are also experimenting to try and find any issues. I'll keep you posted

    Leave a comment:


  • Eran
    replied
    Hi Tim,

    I have done some tests with Strings using Program Loader and didn’t find any issue so far. I will dig deeper and see what might have caused the issues with your partner's system.

    Thanks for your patience.

    Best Regards,

    Leave a comment:


  • Bigtim
    replied
    Originally posted by Eran View Post
    Hi Tim,

    That’s strange. Have you tried recompiling the genie program with higher string value?
    I’ll do some tests on my end as well with the Magic Bytes and see what I can help.

    If you need more clarifications, please don't hesitate to ask.

    Best Regards,
    Yeah I did try recompiling at 200bytes for the buffer just to be sure (our message is around 100 bytes)

    Leave a comment:


  • Eran
    replied
    Hi Tim,

    That’s strange. Have you tried recompiling the genie program with higher string value?
    I’ll do some tests on my end as well with the Magic Bytes and see what I can help.

    If you need more clarifications, please don't hesitate to ask.

    Best Regards,

    Leave a comment:

Working...
X