Announcement

Collapse
No announcement yet.

Problems with strings

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

  • Problems with strings


    Dear community, I've been working with the display "# SK-GEN4-50DCT-CLB #" and a Teensy 3.6 for some time. , Unfortunately I have the problem that some ads flicker when updated, other ads do not flicker and again there are ads that only flicker at start and the flickering then improves at some point. I suspect it is related to the length of the text and / or the size of the text field. Is there information about the circumstances under which this problem occurs and how I can possibly solve it by precaching or something? I tested with a minimal version of the ad:

    #include <genieArduino.h> // Konfiguration // ----------------------------------------------------- #define PC Serial #define Display Serial1 const int BaudPC = 9600; const int BaudDisplay = 9600; // Konfiguration Display // ----------------------------------------------------- Genie genie; #define RESETLINE 2 // Hier Resetpin für das Display eintragen // ----------------------------------------------------- long Zahl; float Count = 111.11; // Setup // ----------------------------------------------------- // ----------------------------------------------------- void setup() { // Setup Serial // --------------------------------------------------- Display.begin(BaudDisplay); PC.begin(BaudPC); Display.flush(); PC.flush(); delay(10); genie.Begin(Display); // --------------------------------------------------- // Setup Display // --------------------------------------------------- pinMode(RESETLINE, OUTPUT); digitalWrite(RESETLINE, 0); // Reset delay(100); digitalWrite(RESETLINE, 1); // unReset delay (5000); //


    let the display start up after the reset (This is important)

    Video: https://youtu.be/XP2mVo6eVas Thanks Hermann
    Last edited by hermann2971; 3 January 2020, 05:31 PM.

  • #2
    #include <genieArduino.h>


    // Konfiguration
    // -----------------------------------------------------
    #define PC Serial
    #define Display Serial1

    const int BaudPC = 9600;
    const int BaudDisplay = 9600;


    // Konfiguration Display
    // -----------------------------------------------------
    Genie genie;

    #define RESETLINE 2 // Hier Resetpin für das Display eintragen
    // -----------------------------------------------------


    long Zahl;
    float Count = 111.11;


    // Setup
    // -----------------------------------------------------
    // -----------------------------------------------------
    void setup() {

    // Setup Serial
    // ---------------------------------------------------
    Display.begin(BaudDisplay);
    PC.begin(BaudPC);
    Display.flush();
    PC.flush();
    delay(10);
    genie.Begin(Display);
    // ---------------------------------------------------


    // Setup Display
    // ---------------------------------------------------
    pinMode(RESETLINE, OUTPUT);

    digitalWrite(RESETLINE, 0); // Reset
    delay(100);
    digitalWrite(RESETLINE, 1); // unReset

    delay (5000); //let the display start up after the reset (This is important)

    genie.WriteContrast(15); // 0 = Display OFF, though to 15 = Max Brightness ON.

    genie.WriteObject(GENIE_OBJ_USERIMAGES, 0x00, 1); // Hintergrundbild
    // ---------------------------------------------------

    }
    // -----------------------------------------------------
    // -----------------------------------------------------



    // Loop
    // -----------------------------------------------------
    // -----------------------------------------------------
    void loop() {

    Zahl = random (-2147483648,2147483648);
    String Text0 = String (Zahl);
    genie.WriteStr(0, Text0);
    delay(100);

    Zahl = random (-2147483648,2147483648);
    String Text1 = String (Count);
    genie.WriteStr(1, Text1);
    delay(100);

    String Text2 = String (Count) +"abcde";
    genie.WriteStr(2, Text2);
    delay(100);

    Count = Count + 0.10;
    }
    // -----------------------------------------------------
    // -----------------------------------------------------
    Last edited by hermann2971; 3 January 2020, 06:50 PM.

    Comment


    • #3
      Hi Herman,

      The 'flicker' occurs because the text on the strings are being redrawn every time you send the genie.WriteStr command.

      As a workaround, you can try to do the instructions written on this forum thread: https://forum.4dsystems.com.au/node/...0186#post60186
      Edit C:\Program Files (x86)\4D Labs\4D Workshop 4 IDE\Include\CLPrintStrings.inc with a text editor.
      Comment out lines 15 and 17, by adding // at the front
      Change the word TRANSPARENT on line 28 to OPAQUE
      Save this file.
      Now rebuild your project.
      Best Regards,
      Kevin

      Comment


      • #4
        Hi Kevin,


        This time the string was printed just as i wish NO FLASHING but i have other problems now, I have the side effects that relate to background colours, that you've described in the forum.
        And i also have some digits of old strings that stuck in new strings.

        Could you please suggest me a solution to fix these issues?

        Thanks in advance,

        Hermann

        Comment


        • #5
          Hi Hermann,

          have the side effects that relate to background colours
          Can you upload your project file so I can see and test it at my end?

          And i also have some digits of old strings that stuck in new strings.
          Please try the suggestion mentioned on the forum thread:
          The main side effect that you might/will see is that if you print "abcd" followed by "123" that the "d" will still be visible, so you will need to pad out your sent strings with blanks (and, depending on the font type, 'double' blanks) to ensure that the old string is erased.
          Best Regards,
          Kevin

          Comment


          • #6

            Hi there I use 10 strings in the display, I can't change everything !! That is far too much work. Have you attached both videos compare With 6 seconds it fits the plinking

            https://youtu.be/6DwvB8BwtZ4

            https://youtu.be/V62NugvPwBE
            Thanks hermann

            Comment


            • #7
              Hi Herman,

              Based on what I see on the video, it seems that the character from the previous message was not being erased when a shorter character length is sent on the display.
              As mentioned in the previous thread, you need to append spaces/blanks to erase the string. Depending on the character size, a double space may be needed.

              Here is a snippet of code for an additional reference:
              Code:
              int tmp, len;
              String Text2 ;
              unsigned long prevTime;
              
              void loop()
                if (millis() - prevTime > 1000)             // update the count every sec
                {
                  Text2 = String(random (0,50000));
                  len = Text2.length();
                  if(tmp!=len){
                    genie.WriteStr(5, Text2 + AppendSpaces());
                    tmp = Text2.length(); // save prev length
                  }
                  else{
                    //Although the text does not change, you need to offset for the size of each char.
                    //Just in case, append an additional space
                    genie.WriteStr(5, Text2 + " ");
                    Serial.println("Does not change!");
                  }  
                  prevTime = millis();
                }
              }
              
              String AppendSpaces(){
                  int i;
                  String spaces;
              
                  //5 is the MAX chars, however, the size for the 'space' is different, so an offset is needed. Adjust this value accordingly
                  for(i = len; i<=7; i++){
                    spaces+=" ";
                  }
                  return spaces; // return no of space to append
              }
              Let me know if that helps.

              Also, if that is not the issue, please do let me know.

              Best Regards,
              Kevin
              Last edited by John Kevin; 8 January 2020, 05:48 PM.

              Comment


              • #8

                Hello Kevin, has 4D Systems decided to change that in the software?
                That's not the point that you have to do a trick to make it work.
                And it slows down the string !! It's not so fluid !!

                Thanks

                Hermann

                Comment


                • John Kevin
                  John Kevin commented
                  Editing a comment
                  Hi Herman,

                  I am sorry but I cannot sort out the issue you are having.
                  The attached code is issued by the host controller. By appending spaces on the string message, the previous string is erased (in case the next message is shorter than the previous one).

                  You can attach here your working code (Ws4 application, and Arduino code) so I can verify and test it on my end.
                  If you want to keep it private, you can send it to my mail: john dot asuncion at 4dsystems dot com dot au.

                  Best Regards,
                  Kevin

              • #9

                274/5000
                Hello Kevin,

                I am currently developing a program that fills the strings with spaces. But have problems with the display. Always have bad signs at the end. What am I doing wrong??

                I created 3 strings in the display.
                String 0-2

                Video and photos in the appendix and the program

                Comment


                • #10
                  #include <genieArduino.h>

                  #define PC Serial
                  #define Display Serial1

                  const int BaudPC = 9600;
                  const int BaudDisplay = 9600;

                  Genie genie;

                  #define RESETLINE 2 // Hier Resetpin für das Display eintragen

                  int Gewicht = 0;
                  int halt = 300;
                  String convert;

                  int StringSize[] = {10,10,10,10,10};


                  void setup() {

                  PC.begin(9600);

                  Display.begin(9600);
                  genie.Begin(Display);

                  //genie.AttachEventHandler(myGenieEventHandler); // Attach the user function Event Handler for processing events

                  pinMode(RESETLINE, OUTPUT);

                  digitalWrite(RESETLINE, 0); // Reset
                  delay(100);
                  digitalWrite(RESETLINE, 1); // unReset

                  delay (5000); //let the display start up after the reset (This is important)

                  genie.WriteContrast(15); // 0 = Display OFF, though to 15 = Max Brightness ON.

                  }


                  void loop() {

                  //genie.DoEvents(); // This calls the library each loop to process the queued responses from the display

                  Gewicht = random(-10000,99999);

                  convert = String(Gewicht);
                  genie.WriteStr(0, convert);
                  delay(halt);

                  WString(1, Gewicht, 'r');
                  delay(halt);

                  WString(2, Gewicht, 'l');
                  delay(halt);
                  }

                  void WString(int StringNummer, String Text, char Ausrichtung) {
                  int Nullstellen = StringSize[StringNummer]-Text.length();
                  String TextNull;

                  if (Nullstellen < 0) TextNull = "size";
                  else {
                  for (int i=Nullstellen; i>0; i--) {
                  TextNull+="x";
                  }

                  if (Ausrichtung=='r') TextNull+=Text;
                  if (Ausrichtung=='l') TextNull= Text+TextNull;
                  }

                  genie.WriteStr(StringNummer, TextNull);

                  PC.print("Zahl:");
                  PC.println(Text);
                  PC.print("Stringnummer:");
                  PC.println(StringNummer);
                  PC.print("Stringsize:");
                  PC.println(StringSize[StringNummer]);
                  PC.print("Textsize:");
                  PC.println(Text.length());
                  PC.print("Nullstellen:");
                  PC.println(Nullstellen);
                  PC.println("----------------------------------");
                  }

                  Comment


                  • #11
                    Whenever a minus appears on the display, half a character is missing.

                    Video attached.

                    https://youtu.be/ixR5_iwzADU

                    Comment


                    • #12
                      Hi Herman,

                      It has something to do with the pixel size of '-'. The solution to your issue is for you to use a monospace font. This font type should give you a fixed width and a fixed height for each character. An example of a monospace font is Courier New.

                      I hope this helps.

                      Best Regards,
                      Kevin

                      Comment


                      • #13
                        Hello Kevin,
                        have now changed that I have fixed numbers and it works.
                        The problem is that the string is not completely filled. See video.
                        The right edge is now black.

                        What is the problem and how can I change it?

                        Thanks Hermann
                        https://youtu.be/QjXjg-vEdcc

                        Thanks Hermann

                        Comment


                        • John Kevin
                          John Kevin commented
                          Editing a comment
                          Hi Hermann,

                          I wonder if the string is not 'stretched' on the designer? Can you attach here the GUI design you made in the Workshop4?

                          Best Regards,
                          Kevin

                      • #14
                        Hallo Kevin,

                        Thanks!
                        Attached Files

                        Comment


                        • #15
                          Hi Hermann,

                          The background is not drawn because there is no character to be filled with. If there is no character in the string, there would also be no background. Since you used a monospace font each character has fixed width and height. The gap you are seeing is the excess amount of space since another character cannot fit in one line. One solution is to adjust the font size, so you could fit all the characters on the screen.

                          An easy fix would be adding a filled rectangle in the form to fill the gap of the background. Please see the attached file.

                          I hope this helps.

                          Best Regards,
                          Kevin
                          Attached Files

                          Comment

                          Working...
                          X