Announcement

Collapse
No announcement yet.

Large Font - low refresh rate ?

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

  • Large Font - low refresh rate ?

    Hi there,

    So I'm trying to use putstr to display text in a large font (Arial Black, 50 point). I followed the 3rd party font appnote, and when I send put str the string is written to the screen a lot slower than I would have expected.

    I used the zip file from the app note and simply changed the fonts and comp'n'loaded to the screen, then loaded the SPE.

    What I am referring to is, I can actually see each digit being drawn out individually rather all at the same time. The string itself isn't large, for example "-30.0".

    The net result is, every time the displayed value needs to be updated, each digit changes individually and it doesn't look right. If the value needs to update more than a couple of times a second it is just becomes a garbled mess of numbers changing at different times and you can't really decipher it.

    I figure it has to do with the volume of data that needs to be written from the SD card to the screen. Smaller fonts update a lot faster.

    My SD card is a transcend 2GB card from Jaycar.

    Any suggestions on how to get large fonts without the laggy visual effect ?

    BTW - using a uoled-128-g2

  • #2


    What you are seeing seems normal.

    I might add I have never been able to get transcend cards to work reliably, they always seem to 'brown out', even in my Windows SPI reader.

    Most cards work at the same speed in SPI mode so using a faster card will not make much difference.

    There are a couple of things you can try

    Opaque vs Transparent Text (Transparent will need you to clear the part of the screen between updates)

    A delay at the end of each update to let the eye adjust to the screen.

    Maybe make the font smaller until it looks better.
    Mark

    Comment


    • #3


      hmm thats a little disappointing.

      Okay - so I've been playing with LED digits widget - I'm guessing this may work better for quicker updates, however I can't seem to get it to display negative values.

      I've seen another thread where you suggest an alternative to using LED digits for negative numbers is using a large font with a string object....... hehe.. which I would prefer to do, but the refresh rate is too slow

      Should I be able to get this to display negative values ? Can we modify the source to adapt it to our needs ?

      Any pointers to do so ?

      Comment


      • #4


        The led digits do not support -ve numbers as there is no -ve symbol generated in the 'slideshow' that drives the led digits.

        Using the latest workshop you can create 'user images' similar to the way led digits are built, that was you could include your own '-' sign and modify the led digits routine to take it into account.

        The refresh rate would be faster, but you will lose the flexibility of a font, mainly, for what you are proposing, that color will be 'fixed'.
        Mark

        Comment


        • #5


          Okay cool - any suggestions/docco I could read to help achieve that ?

          Comment


          • #6


            Hmm, app note D4010 describes how to create userimages although the 'execution' technique is not applicable to goldelox, I suggest something like the setup used on Pages 16, add images 10 as blank and 11 as the minus sign.

            Then you can adapt any ViSi sample to demonstrate the numbers in action (say Thermometer).

            Once you have that working it should work with the "LedDigitsDisplayGoldelox.inc" with no changes.

            Then you just need to modify "LedDigitsDisplayGoldelox.inc" to use image 11 when you want the minus sign
            Mark

            Comment


            • #7


              okay - I think I see what I need to do here.

              If I edit this as you suggest, and get it all working, can I then call it like a standard gauge/widget from the SPE using the videoframe calls ?

              Comment


              • #8


                whilst we're on the topic - is there an appnote that describes in detail what is needed to take a widget and call it via SPE, and if there are any limitations etc to doing so ?

                I get hte basic gist, but I don't really understand the topic well enough

                Comment


                • #9


                  Um, yeah.

                  If you look at the source for the SPE Bigdemo program that might help.

                  Once you create the GCI using ViSi, you then use SPE to show it using video frame calls.

                  Sorry for confusing you with the ViSi 'samples'. You just need to implement them on your Host, shouldn't he that hard.
                  Mark

                  Comment


                  • #10


                    Okay so I've done this, I've ported the 4d code to arduino and am just making serial calls to different videoframes based on your suggestions.

                    I still have the same problem.

                    if I am trying to change 3 digits at the same time, they visibly update one after another, so much so that if values are changing frequently (say a 5 digit number like RPM of an engine) then it just looks a randomly changing mess of numbers.

                    Any other suggestions ? I can't use a smaller digit size than I am already using (about 32 high by 16 wide) - it's already too small given the intended application.

                    Or is it time to consider some other options

                    Comment


                    • #11


                      How long are you pausing for after updating all digits before you start again?

                      I've said it before, if you just keep updating buttons of course it will look like a jumble, you need to take a pause to let your eyes see the static values.

                      Of course that may not be your problem, but based on what I have before me I can't suggest much else.

                      Perhaps post your all of your code?
                      Mark

                      Comment


                      • #12
                        No, the problem is that, if i just update the values displayed on screen once, I can visually see it update each digit in turn, left to right across the screen.

                        I only have to try to write a new value a 2 - 3 times a second for this to become illegible.

                        This is my code:


                        /*********************************************************************************************/

                        /* */

                        /* Goldelox 4D Serial Sample */

                        /* */

                        /* Date: 31 December 2012 */

                        /* */

                        /* Description: Demonstrates Pretty much every 4D Serial command. */

                        /* This has been tested on an Arduino Duemilanove ATmega328 using Arduino */

                        /* 1.0.2 */

                        /* This program, by default, uses the hardware serial on pins 0 and 1 and */

                        /* thus the 5 pin connector on the 4D Arduino Adapter, or the 4Display */

                        /* Shield must be unplugged or jumpers removed before loading your sketch */

                        /* and plugged back in after the error callback is called (i.e. the LED is */

                        /* flashing), then reset the Arduino using the Reset button or by bridging */

                        /* the reset pins (otherwise you will get a message like */

                        /* "avrdude: stk500_getsync(): not in sync: resp=0xe0") */

                        /* */

                        /* The library also supports other hardware serial ports, for the boards */

                        /* that support them, as well as software serial. */

                        /* */

                        /* Define the serial port to use here, if using software serial set it to */

                        /* something like SerialS. */

                        #defineDisplaySerialSerialS

                        /* */

                        /* To use SoftwareSerial uncomment the following and set the pins you are */

                        /* using correctly */

                        #include<SoftwareSerial.h>

                        SoftwareSerialDisplaySerial(10,9);// pin 2 = TX of display, pin3 = RX

                        /* */

                        /* If you are not using hardware serial on pins 0 and 1 you can use this */

                        /* hardware port for logging messages. To do this uncomment the following */

                        #defineLOG_MESSAGES

                        /* */

                        /* The 4Display Shield has its joystick connected directly to Arduino */

                        /* Digital pins 2-6. If you are using the 4D Arduino Adapter, and/or have */

                        /* done your own 'wiring' you could could potentially have a joysick */

                        /* connected to IO1 of goldelox. To use that you need to uncomment the */

                        /* next define. Beware of doubling up on the pins if using SoftwareSerial */

                        /* If you do not have a joystick then comment out the call to test it, or */

                        /* this program will get stuck. */

                        //#define GOLDELOX_JOYSTICK

                        /* */

                        /* The following file needs to be opened with Graphics Composer(GC) and */

                        /* 'saved' to offset 0 of a uSD card in order to perform Media Tests. */

                        /* PoGa Intro\GCI_Demo1\Images\GCI_DEMO1 */

                        /* */

                        /* Error Callback In order to drastically reduce the amount of error checking you need */

                        /* to do a callback exists to perform 'standard' error handling when an */

                        /* occurs. If you want to do your own handling set Callback4D to NULL */

                        /* otherwise set it to the address of the error routine */

                        /* */

                        /* Baud rate change Because the stream class used within the library does not support */

                        /* .end, or .begin the setbaudWait and SetThisBaudrate functions are */

                        /* coded within this demo */

                        /* */

                        /* NB! There is an issue with SoftwareSerial in Arduino 1.0.2 + 1.0.3 and */

                        /* possibly above which affects Goldelox Displays, refer here:- */

                        /* https://github.com/arduino/Arduino/issues/1195 to fix you must edit */

                        /* SoftwareSerial.cpp and find the setTX function and change the first two */

                        /* statements so it becomes:- */

                        /* */

                        /* void SoftwareSerial:etTX(uint8_t tx) */

                        /* { */

                        /* pinMode(tx, INPUT_PULLUP); */

                        /* pinMode(tx, OUTPUT); */

                        /* */

                        /*********************************************************************************************/



                        #ifdefLOG_MESSAGES

                        #defineHWLOGGINGSerial

                        #else

                        #defineHWLOGGINGif(1){}elseSerial

                        #endif



                        #include "Goldelox_Serial_4DLib.h"

                        #include "Goldelox_const4D.h"



                        Goldelox_Serial_4DLibDisplay(&amp;DisplaySerial);



                        // globals for this program

                        intfmediatests;



                        #defineiBoostGaugeH0x0002

                        #defineiBoostGaugeL0xB200

                        #defineiNormGaugeH0x0005

                        #defineiNormGaugeL0xDC00

                        #defineiUserimages1H0x0008

                        #defineiUserimages1L0xF600

                        #defineiUserimages2H0x000D

                        #defineiUserimages2L0x7C00

                        #defineiUserimages3H0x000E

                        #defineiUserimages3L0x9C00







                        intdigitstate[6];



                        voidSetThisBaudrate(intNewrate)

                        {

                        int br ;

                        DisplaySerial.flush();

                        DisplaySerial.end();

                        switch(Newrate)

                        {

                        caseBAUD_110 :br=110;

                        break ;

                        caseBAUD_300 :br=300;

                        break ;

                        caseBAUD_600 :br=600;

                        break ;

                        caseBAUD_1200 :br=1200;

                        break ;

                        caseBAUD_2400 :br=2400;

                        break ;

                        caseBAUD_4800 :br=4800;

                        break ;

                        caseBAUD_9600 :br=9600;

                        break ;

                        caseBAUD_14400 :br=14400;

                        break ;

                        caseBAUD_19200 :br=19200;

                        break ;

                        caseBAUD_31250 :br=31250;

                        break ;

                        caseBAUD_38400 :br=38400;

                        break ;

                        caseBAUD_56000 :br=56000;

                        break ;

                        caseBAUD_57600 :br=57600;

                        break ;

                        caseBAUD_115200:br=115200;

                        break ;

                        caseBAUD_128000:br=133928;// actual rate is not 128000 ;

                        break ;

                        caseBAUD_256000:br=281250;// actual rate is not 256000 ;

                        break ;

                        caseBAUD_300000:br=312500;// actual rate is not 300000 ;

                        break ;

                        caseBAUD_375000:br=401785;// actual rate is not 375000 ;

                        break ;

                        caseBAUD_500000:br=562500;// actual rate is not 500000 ;

                        break ;

                        caseBAUD_600000:br=703125;// actual rate is not 600000 ;

                        break ;

                        }

                        DisplaySerial.begin(br);

                        delay(50);// Display sleeps for 100

                        DisplaySerial.flush();

                        }



                        voidsetbaudWait(word Newrate)

                        {

                        DisplaySerial.print((char)(F_setbaudWait>>8));

                        DisplaySerial.print((char)(F_setbaudWait));

                        DisplaySerial.print((char)(Newrate>>8));

                        DisplaySerial.print((char)(Newrate));

                        SetThisBaudrate(Newrate);// change this systems baud rate to match new display rate, ACK is 100ms away

                        Display.GetAck();

                        }



                        inttrymount(void)

                        {

                        #defineretries15

                        int i ;

                        int j ;

                        i=Display.media_Init();

                        j = 0 ;

                        if(!i)

                        {

                        Display.putstr("Pls insert uSD crd\n") ;

                        while ( (!i)

                        &amp;&ampj<retries))

                        {

                        Display.putstr(".");

                        i=Display.media_Init();

                        j++ ;

                        }

                        Display.putstr("\n");

                        }

                        if(j==retries)

                        returnFALSE;

                        else

                        returnTRUE;

                        }

                        /*



                        #constant Font68FontStartL 0x0

                        #constant Font41FontStartL 0xD6

                        #constant Font16FontStartL 0x12E

                        #constant Font20FontStartL 0x13D

                        iBoostGaugeH 0x0002

                        iBoostGaugeL 0xB200

                        iNormGaugeH 0x0005

                        iNormGaugeL 0xDC00

                        */

                        voidtext_Tests(void)

                        {

                        Display.gfx_Cls();

                        Display.txt_MoveCursor(0,0);









                        floatx=0;

                        // setbaudWait(BAUD_57600) ;



                        while(1)

                        {

                        /*

                        Display.media_SetSector(0x00,0xd6);

                        Display.txt_FontID(7);



                        Display.txt_FGcolour(WHITE);

                        Display.txt_Bold(1);

                        Display.putstr(" 30.0");

                        */

                        //x++;

                        ledDigitsDisplay2(00111,5,0,true,0,0);

                        delay(200);

                        ledDigitsDisplay2(11111,5,0,true,0,0);

                        delay(200);

                        ledDigitsDisplay2(22222,5,0,true,0,0);

                        delay(200);

                        ledDigitsDisplay2(00000,5,0,true,0,0);

                        delay(200);

                        ledDigitsDisplay2(123,5,0,true,0,0);

                        delay(200);

                        ledDigitsDisplay2(654,5,0,true,0,0);

                        delay(200);



                        //Display.media_SetAdd(0x02,0xb200);

                        // Display.media_VideoFrame(112,0,x);

                        // if(x==99) x=0;



                        /*

                        Display.media_SetAdd(0x02,0xb200);

                        Display.media_VideoFrame(112,0,76);

                        delay(70);

                        Display.txt_MoveCursor(0,0) ;

                        Display.txt_Bold(1);

                        Display.putstr(" 15.0");

                        delay(70);

                        Display.txt_MoveCursor(0,0) ;



                        Display.media_SetAdd(0x02,0xb200);

                        Display.media_VideoFrame(112,0,24);

                        */





                        }



                        }



                        voidCallback(intErrCode,unsignedcharErrByte)

                        {

                        #ifdefLOG_MESSAGES

                        const char *Error4DText[] = {"OK\0", "Timeout\0", "NAK\0", "Length\0", "Invalid\0"} ;

                        HWLOGGING.print(F("Serial 4D Library reports error ")) ;

                        HWLOGGING.print(Error4DText[ErrCode]);



                        if(ErrCode==Err4D_NAK)

                        {

                        HWLOGGING.print(F(" returned data= ")) ;

                        HWLOGGING.println(ErrByte);

                        }

                        else

                        HWLOGGING.println(F(""));

                        while(1);// you can return here, or you can loop

                        #else

                        // Pin 13 has an LED connected on most Arduino boards. Just give it a name

                        #defineled13

                        while(1)

                        {

                        digitalWrite(led,HIGH); // turn the LED on (HIGH is the voltage level)

                        delay(200); // wait for a second

                        digitalWrite(led,LOW); // turn the LED off by making the voltage LOW

                        delay(200); // wait for a second

                        }

                        #endif

                        }



                        voidsetup()

                        {

                        #ifdefLOG_MESSAGES

                        HWLOGGING.begin(19200);

                        HWLOGGING.print(F("\n\nBigDemo for Arduino\n"));

                        #endif

                        }



                        voidloop()

                        {

                        inti,rc;

                        charwks[20];

                        Display.TimeLimit4D =5000;// 2 second timeout on all commands

                        Display.Callback4D=Callback;// NULL ;

                        DisplaySerial.begin(9600);



                        Display.gfx_Cls();

                        fmediatests=trymount();





                        text_Tests();// text tests



                        Display.SSTimeout(1000);

                        Display.SSSpeed(1);

                        Display.SSMode(16);



                        while(1){}





                        // Display.SSTimeout(1000) ;

                        // Display.SSSpeed(1) ;

                        // Display.SSMode(0) ;



                        //Display.BeeP(40,2000) ;

                        // Display.gfx_Cls() ;

                        //setbaudWait(BAUD_19200) ;

                        //Display.putstr("Hi at 19200\n") ;

                        //setbaudWait(BAUD_9600) ;

                        //Display.putstr("Back to 9600\n") ;

                        //delay(5000);

                        }



                        /*



                        func ledDigitsDisplayL(var newval, var indexH, var indexL, var left, var top, var Digits, var MinDigits, var WidthDigit, var LeadingBlanks)

                        var i, k, l, lb ;

                        l := 1 ;

                        for (i := 1; i < Digits; i++)

                        l *= 10 ;

                        next

                        lb := LeadingBlanks ;

                        for (i := 0; i < Digits; i++)

                        k := newval / l ;

                        newval -= k * l ;

                        if ( lb &amp;&amp; (i < Digits - MinDigits) )

                        if (k == 0)

                        k := 10 ;

                        else

                        lb := 0 ;

                        endif

                        endif

                        l /= 10 ;

                        media_SetAdd(indexH, indexL) ;

                        media_VideoFrame(left, top+i*WidthDigit,k) ;

                        next

                        endfunc

                        */





                        voidledDigitsDisplay(intnewval,intDigits,intMinDigits,boolLeadingBlanks,byteleft,bytetop)

                        {

                        inti,k,l,lb;

                        l=1;



                        for(i=1;i<Digits;i++)

                        {

                        l*=10;

                        }



                        lb=LeadingBlanks;



                        for(i=0;i<Digits;i++)

                        {

                        k=newval/l;

                        newval-=k*l;

                        if(lb&amp;&ampi<Digits-MinDigits))

                        {

                        if(k==0)

                        {

                        k = 10 ;

                        }

                        else

                        {

                        lb = 0 ;

                        }

                        }

                        l/=10;





                        Display.media_SetAdd(iUserimages3H,iUserimages3L);

                        Display.media_VideoFrame(left+(i*14),top,k);

                        //media_SetAdd(indexH, indexL) ;

                        //media_VideoFrame(left, top+i*WidthDigit,k) ;

                        }

                        }



                        voidledDigitsDisplay2(intnewval,intDigits,intMinDigits,boolLeadingBlanks,byteleft,bytetop)

                        {

                        inti,k,l,lb;

                        l=1;





                        for(i=1;i<Digits;i++)

                        {

                        l*=10;

                        }



                        lb=LeadingBlanks;



                        for(i=0;i<Digits;i++)

                        {

                        k=newval/l;

                        newval-=k*l;



                        if(lb&amp;&ampi<Digits-MinDigits))

                        {

                        if(k==0)

                        {

                        k = -1 ;

                        }

                        else

                        {

                        lb = 0 ;

                        }

                        }

                        l/=10;



                        if(digitstate[i]!=k)

                        {

                        Display.media_SetAdd(iUserimages3H,iUserimages3L);

                        Display.media_VideoFrame(left+(i*15),top,k);

                        }

                        //Display.media_SetAdd(iUserimages3H,iUserimages3L);

                        //Display.media_VideoFrame(left+(i*14),top,k);

                        //media_SetAdd(indexH, indexL) ;

                        //media_VideoFrame(left, top+i*WidthDigit,k) ;

                        digitstate[i]=k;

                        }

                        }




                        Comment


                        • #13


                          So you are using Arduino to send serial commands and have implemented ledDigitsDisplay on the Arduino, fine.

                          I notice that you have selected 9600 as the baud rate. This means you can send and receive, roughly 960 characters per second.

                          You need to send two commands for each digit media_SetAdd and media_VideoFrame, together they have an 'overhead' of 16 bytes.

                          So, the baud rate means you can only send about 60 'digits' per second to the display (I say about because there are latency issues and the display takes a certain amount of time to display each digit)

                          Since you seem to be using 5 digits per display that's a maximum of 12 'displays' per second.

                          Try upping your baud rate to 115200 and see if that makes you happier
                          Mark

                          Comment

                          Working...
                          X