TFT Refresh Problem

Code tips and tricks for beginners
User avatar
Electroguard
Posts: 946
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 310 times
Been thanked: 352 times

Re: TFT Refresh Problem

Post by Electroguard »

It is because the size of the new text msg can vary - and when the program is first run is the ONLY time everything is written correctly... before the msg contents are changed and mess things up.

So if you update eg: "ABCDEFG" with "XYZ" you will end up with something like XYZDEFG unless you first overwrite ALL of the previous characters with blank spaces ... which is presumably what you are doing.
BUT, if you overwrite the complete line full of blanks, you also overwrite everything else that was on that line, including the borders.

It is easier to understand what is happening if you temporarily use a background colour for writing out blank lines, and a different background colour for text msgs.

Don't think of your text msgs as lines, think of them as windows which must start at x and can only be x+window length long to avoid overwriting window borders.

If was me, I would assign different msg window names with appropriate coordinates and character lengths, to make it easier to blank just the required windows before writing new info to them.
Temporary use of a msg background colour will allow correct message window positioning with absolute certainty, then once everything is working correctly you can remove the background colours.
User avatar
cicciocb
Site Admin
Posts: 2195
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 470 times
Been thanked: 1461 times
Contact:

Re: TFT Refresh Problem

Post by cicciocb »

Hello,
what is the model of the TFT that you are using?

It looks that you are using a 480x320 TFT, right?
Post Reply