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

text cover using textpadding don't work #3626

Open
rozrabiak opened this issue Jan 18, 2025 · 0 comments
Open

text cover using textpadding don't work #3626

rozrabiak opened this issue Jan 18, 2025 · 0 comments

Comments

@rozrabiak
Copy link

rozrabiak commented Jan 18, 2025

Hi, I trying to cover text on TFT, but this code doesn't work for me.
Can anyone help me?

void hmi::printRpm(int rpm)
{
    int _rpm = rpm;
    String rpmString = String(_rpm);
    tft.setCursor(38, 110);
    tft.setTextFont(7);
    tft.setTextSize(1);

    tft.setTextColor(TXT_COLOR, BG_COLOR);
    int16_t w = tft.textWidth("888", 7); // Width of maximum length string)

    tft.setTextPadding(w); // Set blanking width to string length
    tft.setTextDatum(TL_DATUM); // Set datum to top left

    tft.print(rpmString);
    tft.setTextPadding(0);
}
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

1 participant