Go Down

Topic: SeeedStudio TFT V2.0 text direction added (Read 20791 times) previous topic - next topic

arduinodlb

Vocho,

You could try using UTFT by Henning Karlsen. It has text rotation and portrait/landscape mode built in. I haven't tried it with the Seeedstudio TFT however.
Do not IM me. I will not respond. Ask questions in the forum.

-__-


The comments you make with setDysplayDirect:  the words left2right and right2left and down2up or up2down suggests that it flips in a vertical or horizontal way, and that's not the same as rotating from portrait to landscape.


Did you actually try it?

-__-

-__-


I am new to C, I hope I can help, good with regard to this I have taken another major problem that the rotation of the screen, I try to make a clock using DS1307 RTC with TINY, however does not show me the right way numbers, ie 1,2,3 but prints all over the account if done right of 0-59 but not let me see the numbers because they never clean the previous issue, I attached a picture, hoping you can help me I thank you in advance for the attention paid,



Vocho,

I didn't see any picture of your problem.  Your code, which has no text direction commands,  compiles when I remove Wire.write(0x00);, and when run, displays some text and three circles with text within. 

I don't have the RTC hardware, so I won't receive any data.

I think the problem you have with "but prints all over the account if done right of 0-59 but not let me see the numbers because they never clean the previous issue" is that the you aren't clearing a displayed number before the next number is drawn.

That's just a guess as your picture you say you attached isn't here.

-__-


slushbilly

I was wondering what the difference is between the new and old library as far as the font style goes? It seems a lot larger now and more space is between the text. As far as the changes for the text direction.... Thanks a lot. Works great and was exactly what I was looking for.

odelay17

FOR THOSE EXPERIENCING ISSUES WITH NUMBER ORIENTATION

In addition to the OP's orientation code, another issue will exist when dealing with number printouts in different orientations.  Hopefully I save some time for others having this this issue.  If you do not change the logic when writing a number larger than a single integer, the number will appear to stack on top of itself.

In my example my orientation is changed to "Tft.setDisplayDirect(UP2DOWN);"

In this landscape configuration, in order to get the numbers to display correctly you must edit the TFTV2.CPP file.  Note the changes I needed to make to the poX variable.  I needed to change the font space to move with respect to poY instead of poX.  Hope this helps.

Code: [Select]
INT8U TFT::drawNumber(long long_num,INT16U poX, INT16U poY,INT16U size,INT16U fgcolor)
{
    INT8U char_buffer[10] = "";
    INT8U i = 0;
    INT8U f = 0;

    if (long_num < 0)
    {
        f=1;
        drawChar('-',poX, poY, size, fgcolor);
        long_num = -long_num;
        if(poX < MAX_X)
        {
            poY += FONT_SPACE*size; /* Move cursor right            */
        }
    }
    else if (long_num == 0)
    {
        f=1;
        drawChar('0',poX, poY, size, fgcolor);
        return f;
        if(poX < MAX_X)
        {
            poY += FONT_SPACE*size;/* Move cursor right            */
        }
    }

    while (long_num > 0)
    {
        char_buffer[i++] = long_num % 10;
        long_num /= 10;
    }

    f = f+i;
    for(; i > 0; i--)
    {
        drawChar('0'+ char_buffer[i - 1],poX, poY, size, fgcolor);
        if(poX < MAX_X)
        {
            poY+=FONT_SPACE*size;  /* Move cursor right            */
        }
    }
    return f;
}

Go Up