Announcement

Collapse
No announcement yet.

Keyboard Object Question

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

  • #61
    Fantastic thamks Eran

    Comment


    • #62
      Originally posted by Eran View Post
      Hi Tim,

      Congratulations on building your project.

      Workshop4 IDE folder has actually a program called LoadProgram.exe that lets you upload code without opening Workshop4 itself. The program is a straightforward program and is easy to use. You can find this in C:\Program Files (x86)\4D Labs\4D Workshop 4 IDE\DEP folder. The gci files and dat files should be manually copied to the SDCard and your project is ready.

      [ATTACH]n64824[/ATTACH]

      Also, Workshop4 offers a 7-day free trial of its Pro version. Just go to Files > Options > License and Click Start Pro Trial.

      There is another option as well that lets you transfer files using Serial Cable Utility and is posted here: https://forum.4dsystems.com.au/forum...lity#post62492


      Hope this helps and all the best for your project.
      Hi Eran,

      my development partner has hit a bit of a snag using the program loader. Code that works on my system is not working correctly on his (loaded via the programme loader)

      One thing we are not sure of, my software requires the maximum string length to be increased from the default value of 75 in the genie options. When I compile the code does this setting get 'compiled' such that his screen will also have this increased setting when the code is loaded using the programme loader?

      Thanks

      Tim

      Comment


      • #63
        Hi Tim,

        Upon compilation of your program, the String length is compiled with the value that you set the genie with. This should also be reflected on other displays (same type) when your 4XE file is loaded to theirs.

        Can you elaborate the “snag” so we can help you more?

        Best Regards,
        Eran

        Comment


        • #64
          Thanks Eran,

          Our snag is that communication messages between the Arduino and the display is not working as we expected on my partners system. It works fine on my test rig (thanks to you ) but not when the same Arduino sketch and set of 4d files are transferred to my partners system which in theory is identical. We are going to do a little bit of debugging to make sure its not something stupid.

          Just wanted to check that the string buffer thing wasn't the problem which it sounds like it isn't. For total clarity, when you say '
          should also be reflected on other displays (same type)' you mean the setting comes from the 4XE file I created and does not need setting 'manually' in my partners IDE?

          Another stupid question, my friend only recently bought his screen and mine is around a year old. I have the gen4-uLCD-43DT there isn't a 'new version is there that could make them 'not the same type'?

          Tim

          Comment


          • #65
            Hi Tim,

            “For total clarity, when you say ' should also be reflected on other displays (same type)' you mean the setting comes from the 4XE file I created and does not need setting 'manually' in my partners IDE?”
            Yes. When your program is compiled into a 4XE file, all settings that you set manually are compiled as well.

            “I have the gen4-uLCD-43DT there isn't a 'new version is there that could make them 'not the same type'?”
            What I meant about "the same type" is the Display Model/Unit (Same size and either Capacitive/Resistive/Non-touch). The revision number doesn’t have anything to do with it so it’s not an issue regarding with the Program Loader tool, but just in case you’re wondering, the revision number can be found on the back of the display.
            Click image for larger version

Name:	revisionNumber.png
Views:	1
Size:	560.8 KB
ID:	65239 ​​​​​​​

            Best Regards,
            Eran

            Comment


            • #66
              Thanks Eran, we will keep on debugging

              What's weird is that my Arduino sketch and 4GL code is working on my system, and the comms from the screen to the Arduino work on his system (ie his magic handler is receiving the message from the screen correctly), but the message he sends to the screen in response appears not to be being picked up (a write magic bytes message) I believe the comms to the screen is working because he can perform basic event stuff like change forms etc.

              Comment


              • #67
                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,
                Eran

                Comment


                • #68
                  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)

                  Comment


                  • #69
                    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,
                    Eran

                    Comment


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

                      Comment


                      • #71
                        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
                        Eran

                        Comment


                        • #72
                          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.

                          Comment


                          • #73
                            Hi Tim,

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

                            All the best,
                            Eran

                            Comment


                            • #74
                              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:	1
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, 07:46 AM.

                              Comment


                              • #75
                                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, 07:56 AM.

                                Comment

                                Working...
                                X