Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TFT_eSPI/examples/Sprite/Animated_dial - Still Working ? #1802

Closed
bionicbone opened this issue Apr 28, 2022 · 7 comments
Closed

TFT_eSPI/examples/Sprite/Animated_dial - Still Working ? #1802

bionicbone opened this issue Apr 28, 2022 · 7 comments

Comments

@bionicbone
Copy link

bionicbone commented Apr 28, 2022

First, thanks for this awesome library, I have worked through most of the examples and the capabilities with just a little code are amazing.

I wonder if you can confirm the example examples/Sprite/Animated_dial/ still works with the current version. When I initially tried this with a older versions of libraries installed it worked well, since then I updated to the latest version of several drivers and now the font in the middle is corrupted.

If I do not load the font, then a standard small font is used and then it is fine.

image

Arduino IDE v1.8.19
TFT_eSPI v1.2.1
ESP32 Boards Manager v2.0.2
ESP32 Wroover Module
Display ILI9341 v1.5.10 on SPI interface

@Bodmer
Copy link
Owner

Bodmer commented Apr 28, 2022

Ah, a new rendering approach is used for smooth fonts that requires an additional parameter. The new approach reduces flicker dramatically.

// Adding a parameter "true" to the setTextColor() function fills character background
    // This extra parameter is only for smooth fonts!
    tft.setTextColor(TFT_GREEN, TFT_BLACK, true);

I will update the example.

@Bodmer Bodmer closed this as completed in 22901f5 Apr 28, 2022
@Bodmer
Copy link
Owner

Bodmer commented Apr 28, 2022

I have updated the library github master example.

@bionicbone
Copy link
Author

bionicbone commented Apr 29, 2022

Unfortunately this still does not work for me.

I reinstalled the library, just in case and did an overwrite of the example to make sure I got the latest updated github version.

Looking at the updated example " examples/Sprite/Animated_dial/" there is a slight bug, bg_color needed to initiated as global since it is now used in both setup() & plotNeedle()

However, for me the font is still corrupted in the middle of the dial even with the "spr.setTextColor(TFT_WHITE, bg_color, true);" changes.

I note that in the example "examples\Smooth Fonts\FLASH_Array\Font_Demo_1_Array" you have recently updated this code to remove the overlay of the rectangle and use the ",true" statement instead and this works successfully for me perfectly.
EDIT: But if the example was counting down then the rectangle would still be required as the number shrinks in length.

However, this example is not using a sprite to display the text.

Question: What is the advantage of using a sprit for text ?

Sorry this is probably a discussion now, but I did not want to loose the thread above...

@bionicbone
Copy link
Author

bionicbone commented Apr 29, 2022

Just drilling in a bit using visual micro we can see as the sprite updates using breakpoints there is some corruption of the font.

NOTE: It does the same with Arduino IDE

image

image

image

image

image

Bodmer added a commit that referenced this issue Apr 29, 2022
@Bodmer
Copy link
Owner

Bodmer commented Apr 29, 2022

I have updated the sprite.cpp file to fix this.

Thanks for reporting the problem.

@bionicbone
Copy link
Author

Perfect, thank you for your trouble in resolving this.

Just so you know, because I think the example " examples/Sprite/Animated_dial/" is perfect to demonstrate flicker free needles on top of gauges.

There is a slight compile error, bg_color needs to be initialised in the header with the others because it is used in the setup() & plotNeedle() and for me I increase the spr_width using "777" the remove some artifects / white dots

uint16_t* tft_buffer;
bool      buffer_loaded = false;
uint16_t  spr_width = 0;
uint16_t**  bg_color = 0;
  bg_color = tft.readPixel(120, 120); // Get colour from dial centre
 spr_width = spr.textWidth("777");

Thank you again

Bodmer added a commit that referenced this issue Apr 30, 2022
@Bodmer
Copy link
Owner

Bodmer commented Apr 30, 2022

Thanks. Have updated example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants