From 7fc8b99b6473b449e2db7276fd86975a1943c88f Mon Sep 17 00:00:00 2001 From: Bodmer Date: Mon, 18 Apr 2022 19:15:40 +0100 Subject: [PATCH] Add new background fill approach to smooth fonts A new background rendering approach is used for smooth fonts which almost eliminates flicker. tft.print... can now be used with a background rendered for smooth fonts. Font_Demo_1/2/3... examples have been updated. A new "docs" folder has been created and files moved there. The Tools folder now only contains support tools. #1757 fixed by using Arduino calls. A new USER_SETUP_ID parameter can be added to setup files and checked via a new verifySetupID(id); function. Version raised to v2.4.50 --- Extensions/Smooth_font.cpp | 107 ++++++++++++++---- Processors/TFT_eSPI_ESP32.c | 24 +--- Processors/TFT_eSPI_RP2040.h | 4 +- TFT_config.h | 11 +- TFT_eSPI.cpp | 78 ++++++++++--- TFT_eSPI.h | 47 ++++---- Tools/{Images => bmp2array4bit}/README.md | 0 .../bmp2array4bit.py | 0 Tools/{Images => bmp2array4bit}/star.bmp | Bin User_Setup.h | 2 + .../Setup100_RP2040_ILI9488_parallel.h | 1 + .../Setup101_RP2040_ILI9481_parallel.h | 1 + .../Setup102_RP2040_ILI9341_parallel.h | 1 + .../Setup103_RP2040_ILI9486_parallel.h | 1 + User_Setups/Setup104_RP2040_ST7796_parallel.h | 1 + User_Setups/Setup10_RPi_touch_ILI9486.h | 1 + User_Setups/Setup11_RPi_touch_ILI9486.h | 2 + User_Setups/Setup12_M5Stack_Basic_Core.h | 1 + User_Setups/Setup135_ST7789.h | 1 + User_Setups/Setup136_LilyGo_TTV.h | 1 + User_Setups/Setup137_LilyGo_TDisplay_RP2040.h | 1 + User_Setups/Setup13_ILI9481_Parallel.h | 1 + User_Setups/Setup14_ILI9341_Parallel.h | 1 + User_Setups/Setup15_HX8357D.h | 1 + User_Setups/Setup16_ILI9488_Parallel.h | 1 + User_Setups/Setup17_ePaper.h | 1 + User_Setups/Setup18_ST7789.h | 1 + User_Setups/Setup19_RM68140_Parallel.h | 1 + User_Setups/Setup1_ILI9341.h | 1 + User_Setups/Setup200_GC9A01.h | 1 + User_Setups/Setup201_WT32_SC01.h | 1 + User_Setups/Setup202_SSD1351_128.h | 1 + User_Setups/Setup203_ST7789.h | 1 + User_Setups/Setup20_ILI9488.h | 1 + User_Setups/Setup21_ILI9488.h | 1 + User_Setups/Setup22_TTGO_T4.h | 3 + User_Setups/Setup22_TTGO_T4_v1.3.h | 3 +- User_Setups/Setup23_TTGO_TM.h | 3 + User_Setups/Setup24_ST7789.h | 1 + User_Setups/Setup25_TTGO_T_Display.h | 3 + User_Setups/Setup26_TTGO_T_Wristband.h | 2 + User_Setups/Setup27_RPi_ST7796_ESP32.h | 2 + User_Setups/Setup28_RPi_ST7796_ESP8266.h | 1 + User_Setups/Setup29_ILI9341_STM32.h | 1 + User_Setups/Setup2_ST7735.h | 1 + User_Setups/Setup30_ILI9341_Parallel_STM32.h | 4 +- User_Setups/Setup31_ST7796_Parallel_STM32.h | 2 +- User_Setups/Setup32_ILI9341_STM32F103.h | 1 + User_Setups/Setup33_RPi_ILI9486_STM32.h | 2 +- User_Setups/Setup34_ILI9481_Parallel_STM32.h | 2 +- User_Setups/Setup35_ILI9341_STM32_Port_Bus.h | 2 +- User_Setups/Setup36_RPi_touch_ST7796.h | 1 + User_Setups/Setup3_ILI9163.h | 1 + User_Setups/Setup43_ST7735.h | 2 +- User_Setups/Setup44_TTGO_CameraPlus.h | 1 + User_Setups/Setup45_TTGO_T_Watch.h | 2 + User_Setups/Setup46_GC9A01_ESP32.h | 2 + User_Setups/Setup47_ST7735.h | 1 + User_Setups/Setup4_S6D02A1.h | 1 + User_Setups/Setup50_SSD1963_Parallel.h | 2 +- User_Setups/Setup51_LilyPi_ILI9481.h | 2 + User_Setups/Setup52_LilyPi_ST7796.h | 2 + User_Setups/Setup5_RPi_ILI9486.h | 1 + User_Setups/Setup60_RP2040_ILI9341.h | 2 +- User_Setups/Setup61_RP2040_ILI9341_PIO_SPI.h | 2 +- .../Setup62_RP2040_Nano_Connect_ILI9341.h | 2 +- User_Setups/Setup6_RPi_Wr_ILI9486.h | 1 + User_Setups/Setup70_ESP32_S2_ILI9341.h | 2 +- User_Setups/Setup71_ESP32_S2_ST7789.h | 2 +- User_Setups/Setup72_ESP32_ST7789_172x320.h | 1 + User_Setups/Setup7_ST7735_128x128.h | 1 + User_Setups/Setup8_ILI9163_128x128.h | 1 + User_Setups/Setup9_ST7735_Overlap.h | 1 + User_Setups/SetupX_Template.h | 1 + .../ESP32 UNO board mod.jpg | Bin .../ESP32 UNO board pinout.jpg | Bin .../PlatformIO/Configuring options.txt | 0 .../RPi_TFT_Connections.png | Bin .../RPi_TFT_connections}/RPi_TFT_mod.png | Bin .../Font_Demo_1_Array/Font_Demo_1_Array.ino | 12 +- .../Font_Demo_2_Array/Font_Demo_2_Array.ino | 10 +- .../Font_Demo_3_Array/Font_Demo_3_Array.ino | 2 +- .../Smooth_font_reading_TFT.ino | 2 +- .../LittleFS/Font_Demo_1/Font_Demo_1.ino | 8 +- .../LittleFS/Font_Demo_2/Font_Demo_2.ino | 8 +- .../SPIFFS/Font_Demo_1/Font_Demo_1.ino | 8 +- .../SPIFFS/Font_Demo_2/Font_Demo_2.ino | 8 +- library.json | 2 +- library.properties | 2 +- 89 files changed, 307 insertions(+), 121 deletions(-) rename Tools/{Images => bmp2array4bit}/README.md (100%) rename Tools/{Images => bmp2array4bit}/bmp2array4bit.py (100%) rename Tools/{Images => bmp2array4bit}/star.bmp (100%) rename {Tools => docs}/ESP32 UNO board mod/ESP32 UNO board mod.jpg (100%) rename {Tools => docs}/ESP32 UNO board mod/ESP32 UNO board pinout.jpg (100%) rename {Tools => docs}/PlatformIO/Configuring options.txt (100%) rename {Tools => docs/RPi_TFT_connections}/RPi_TFT_Connections.png (100%) rename {Tools => docs/RPi_TFT_connections}/RPi_TFT_mod.png (100%) diff --git a/Extensions/Smooth_font.cpp b/Extensions/Smooth_font.cpp index fa94c59..56e623c 100644 --- a/Extensions/Smooth_font.cpp +++ b/Extensions/Smooth_font.cpp @@ -58,7 +58,7 @@ void TFT_eSPI::loadFont(String fontName, bool flash) The bitmaps start next at 24 + (28 * gCount) bytes from the start of the file. Each pixel is 1 byte, an 8 bit Alpha value which represents the transparency from - 0xFF foreground colour, 0x00 background. The sketch uses a linear interpolation + 0xFF foreground colour, 0x00 background. The library uses a linear interpolation between the foreground and background RGB component colours. e.g. pixelRed = ((fgRed * alpha) + (bgRed * (255 - alpha))/255 To gain a performance advantage fixed point arithmetic is used with rounding and @@ -86,7 +86,7 @@ void TFT_eSPI::loadFont(String fontName, bool flash) // | gHeight ....@@@@@..@@ + + <-- baseline // | | ...........@@ | // | | ...........@@ | gdY is the offset to the top edge of the bitmap - // | | .@@.......@@. descent plot top edge of bitmap at (cursorY + yAdvance - gdY) + // | | .@@.......@@. descent plot top edge of bitmap at (cursorY + ascent - gdY) // | + x..@@@@@@@..x | x marks the corner pixels of the bitmap // | | // +---------------------------+ yAdvance is y delta for the next line, font size or (ascent + descent) @@ -206,7 +206,7 @@ void TFT_eSPI::loadMetrics(void) // Different glyph sets have different ascent values not always based on "d", so we could get // the maximum glyph ascent by checking all characters. BUT this method can generate bad values - // for non-existant glyphs, so we will reply on processing for the value and disable this code for now... + // for non-existent glyphs, so we will reply on processing for the value and disable this code for now... /* if (gdY[gNum] > gFont.maxAscent) { @@ -316,7 +316,7 @@ uint32_t TFT_eSPI::readInt32(void) #ifdef FONT_FS_AVAILABLE if (fs_font) { - val |= fontFile.read() << 24; + val = fontFile.read() << 24; val |= fontFile.read() << 16; val |= fontFile.read() << 8; val |= fontFile.read(); @@ -324,7 +324,7 @@ uint32_t TFT_eSPI::readInt32(void) else #endif { - val |= pgm_read_byte(fontPtr++) << 24; + val = pgm_read_byte(fontPtr++) << 24; val |= pgm_read_byte(fontPtr++) << 16; val |= pgm_read_byte(fontPtr++) << 8; val |= pgm_read_byte(fontPtr++); @@ -362,16 +362,27 @@ void TFT_eSPI::drawGlyph(uint16_t code) uint16_t fg = textcolor; uint16_t bg = textbgcolor; + // Check if cursor has moved + if (last_cursor_x != cursor_x) + { + bg_cursor_x = cursor_x; + last_cursor_x = cursor_x; + } + if (code < 0x21) { if (code == 0x20) { - //if (fg!=bg) fillRect(cursor_x, cursor_y, gFont.spaceWidth, gFont.yAdvance, bg); + if (_fillbg) fillRect(bg_cursor_x, cursor_y, (cursor_x + gFont.spaceWidth) - bg_cursor_x, gFont.yAdvance, bg); cursor_x += gFont.spaceWidth; + bg_cursor_x = cursor_x; + last_cursor_x = cursor_x; return; } if (code == '\n') { cursor_x = 0; + bg_cursor_x = 0; + last_cursor_x = 0; cursor_y += gFont.yAdvance; if (textwrapY && (cursor_y >= height())) cursor_y = 0; return; @@ -388,6 +399,7 @@ void TFT_eSPI::drawGlyph(uint16_t code) { cursor_y += gFont.yAdvance; cursor_x = 0; + bg_cursor_x = 0; } if (textwrapY && ((cursor_y + gFont.yAdvance) >= height())) cursor_y = 0; if (cursor_x == 0) cursor_x -= gdX[gNum]; @@ -398,7 +410,7 @@ void TFT_eSPI::drawGlyph(uint16_t code) #ifdef FONT_FS_AVAILABLE if (fs_font) { - fontFile.seek(gBitmap[gNum], fs::SeekSet); // This is taking >30ms for a significant position shift + fontFile.seek(gBitmap[gNum], fs::SeekSet); pbuffer = (uint8_t*)malloc(gWidth[gNum]); } #endif @@ -406,15 +418,46 @@ void TFT_eSPI::drawGlyph(uint16_t code) int16_t cy = cursor_y + gFont.maxAscent - gdY[gNum]; int16_t cx = cursor_x + gdX[gNum]; - int16_t xs = cx; - uint32_t dl = 0; + // if (cx > width() && bg_cursor_x > width()) return; + // if (cursor_y > height()) return; + + int16_t fxs = cx; + uint32_t fl = 0; + int16_t bxs = cx; + uint32_t bl = 0; + int16_t bx = 0; uint8_t pixel; startWrite(); // Avoid slow ESP32 transaction overhead for every pixel - //if (fg!=bg) fillRect(cursor_x, cursor_y, gxAdvance[gNum], gFont.yAdvance, bg); + int16_t fillwidth = 0; + uint16_t fillheight = 0; - for (int y = 0; y < gHeight[gNum]; y++) + // Fill area above glyph + if (_fillbg) { + fillwidth = (cursor_x + gxAdvance[gNum]) - bg_cursor_x; + if (fillwidth > 0) { + fillheight = gFont.maxAscent - gdY[gNum]; + if (fillheight > 0) { + fillRect(bg_cursor_x, cursor_y, fillwidth, fillheight, textbgcolor); + } + } + else { + // Could be negative + fillwidth = 0; + } + + // Fill any area to left of glyph + if (bg_cursor_x < cx) fillRect(bg_cursor_x, cy, cx - bg_cursor_x, gHeight[gNum], textbgcolor); + // Set x position in glyph area where background starts + if (bg_cursor_x > cx) bx = bg_cursor_x - cx; + // Fill any area to right of glyph + if (cx + gWidth[gNum] < cursor_x + gxAdvance[gNum]) { + fillRect(cx + gWidth[gNum], cy, (cursor_x + gxAdvance[gNum]) - (cx + gWidth[gNum]), gHeight[gNum], textbgcolor); + } + } + + for (int32_t y = 0; y < gHeight[gNum]; y++) { #ifdef FONT_FS_AVAILABLE if (fs_font) { @@ -432,7 +475,8 @@ void TFT_eSPI::drawGlyph(uint16_t code) } } #endif - for (int x = 0; x < gWidth[gNum]; x++) + + for (int32_t x = 0; x < gWidth[gNum]; x++) { #ifdef FONT_FS_AVAILABLE if (fs_font) pixel = pbuffer[x]; @@ -442,28 +486,44 @@ void TFT_eSPI::drawGlyph(uint16_t code) if (pixel) { + if (bl) { drawFastHLine( bxs, y + cy, bl, bg); bl = 0; } if (pixel != 0xFF) { - if (dl) { - if (dl==1) drawPixel(xs, y + cy, fg); - else drawFastHLine( xs, y + cy, dl, fg); - dl = 0; + if (fl) { + if (fl==1) drawPixel(fxs, y + cy, fg); + else drawFastHLine( fxs, y + cy, fl, fg); + fl = 0; } if (getColor) bg = getColor(x + cx, y + cy); drawPixel(x + cx, y + cy, alphaBlend(pixel, fg, bg)); } else { - if (dl==0) xs = x + cx; - dl++; + if (fl==0) fxs = x + cx; + fl++; } } else { - if (dl) { drawFastHLine( xs, y + cy, dl, fg); dl = 0; } + if (fl) { drawFastHLine( fxs, y + cy, fl, fg); fl = 0; } + if (_fillbg) { + if (x >= bx) { + if (bl==0) bxs = x + cx; + bl++; + } + } } } - if (dl) { drawFastHLine( xs, y + cy, dl, fg); dl = 0; } + if (fl) { drawFastHLine( fxs, y + cy, fl, fg); fl = 0; } + if (bl) { drawFastHLine( bxs, y + cy, bl, bg); bl = 0; } + } + + // Fill area below glyph + if (fillwidth > 0) { + fillheight = (cursor_y + gFont.yAdvance) - (cy + gHeight[gNum]); + if (fillheight > 0) { + fillRect(bg_cursor_x, cy + gHeight[gNum], fillwidth, fillheight, textbgcolor); + } } if (pbuffer) free(pbuffer); @@ -472,10 +532,12 @@ void TFT_eSPI::drawGlyph(uint16_t code) } else { - // Not a Unicode in font so draw a rectangle and move on cursor + // Point code not in font so draw a rectangle and move on cursor drawRect(cursor_x, cursor_y + gFont.maxAscent - gFont.ascent, gFont.spaceWidth, gFont.ascent, fg); cursor_x += gFont.spaceWidth + 1; } + bg_cursor_x = cursor_x; + last_cursor_x = cursor_x; } /*************************************************************************************** @@ -511,12 +573,9 @@ void TFT_eSPI::showFont(uint32_t td) setCursor(cursorX, cursorY); drawGlyph(gUnicode[i]); cursorX += gxAdvance[i]; - //cursorX += printToSprite( cursorX, cursorY, i ); yield(); } delay(timeDelay); fillScreen(textbgcolor); - //fontFile.close(); - } diff --git a/Processors/TFT_eSPI_ESP32.c b/Processors/TFT_eSPI_ESP32.c index 1a5b946..b772e97 100644 --- a/Processors/TFT_eSPI_ESP32.c +++ b/Processors/TFT_eSPI_ESP32.c @@ -133,17 +133,7 @@ uint8_t TFT_eSPI::readByte(void) ***************************************************************************************/ void TFT_eSPI::busDir(uint32_t mask, uint8_t mode) { - gpioMode(TFT_D0, mode); - gpioMode(TFT_D1, mode); - gpioMode(TFT_D2, mode); - gpioMode(TFT_D3, mode); - gpioMode(TFT_D4, mode); - gpioMode(TFT_D5, mode); - gpioMode(TFT_D6, mode); - gpioMode(TFT_D7, mode); - return; - /* - // Arduino generic native function, but slower + // Arduino generic native function pinMode(TFT_D0, mode); pinMode(TFT_D1, mode); pinMode(TFT_D2, mode); @@ -152,7 +142,7 @@ void TFT_eSPI::busDir(uint32_t mask, uint8_t mode) pinMode(TFT_D5, mode); pinMode(TFT_D6, mode); pinMode(TFT_D7, mode); - return; //*/ + return; } /*************************************************************************************** @@ -161,14 +151,8 @@ void TFT_eSPI::busDir(uint32_t mask, uint8_t mode) ***************************************************************************************/ void TFT_eSPI::gpioMode(uint8_t gpio, uint8_t mode) { - if(mode == INPUT) GPIO.enable_w1tc = ((uint32_t)1 << gpio); - else GPIO.enable_w1ts = ((uint32_t)1 << gpio); - - ESP_REG(DR_REG_IO_MUX_BASE + esp32_gpioMux[gpio].reg) // Register lookup - = ((uint32_t)2 << FUN_DRV_S) // Set drive strength 2 - | (FUN_IE) // Input enable - | ((uint32_t)2 << MCU_SEL_S); // Function select 2 - GPIO.pin[gpio].val = 1; // Set pin HIGH + pinMode(pin, mode); + digitalWrite(pin, HIGH); } //////////////////////////////////////////////////////////////////////////////////////// #endif // #ifdef TFT_PARALLEL_8_BIT diff --git a/Processors/TFT_eSPI_RP2040.h b/Processors/TFT_eSPI_RP2040.h index 6bd05cd..f3495b6 100644 --- a/Processors/TFT_eSPI_RP2040.h +++ b/Processors/TFT_eSPI_RP2040.h @@ -292,11 +292,9 @@ #elif defined (ILI9225_DRIVER) // Needs gaps between commands + data bytes, so use slower transfer functions - // These all end in 8 bit mode + // Warning: these all end in 8 bit SPI mode! #define tft_Write_8(C) spi.transfer(C); - // Note: the following macros do not wait for the end of transmission - #define tft_Write_16(C) spi.transfer16(C) #define tft_Write_16N(C) spi.transfer16(C) diff --git a/TFT_config.h b/TFT_config.h index d77a3eb..8cab8de 100644 --- a/TFT_config.h +++ b/TFT_config.h @@ -1,5 +1,14 @@ + +/////////////////////////////////////////////////////////// +/* Support file for ESP32 IDF use */ +/* See library docs folder */ +/* */ +/* DO NOT EDIT THIS FILE */ +/* */ +/////////////////////////////////////////////////////////// + /** - * @file utility.h + * @file TFT_config.h * @author Ricard BitriĆ” Ribes (https://github.com/dracir9) * Created Date: 22-01-2022 * ----- diff --git a/TFT_eSPI.cpp b/TFT_eSPI.cpp index 840c53e..eea3edb 100644 --- a/TFT_eSPI.cpp +++ b/TFT_eSPI.cpp @@ -262,7 +262,7 @@ bool TFT_eSPI::checkViewport(int32_t x, int32_t y, int32_t w, int32_t h) /*************************************************************************************** ** Function name: resetViewport -** Description: Reset viewport to whle TFT screen, datum at 0,0 +** Description: Reset viewport to whole TFT screen, datum at 0,0 ***************************************************************************************/ void TFT_eSPI::resetViewport(void) { @@ -442,12 +442,15 @@ TFT_eSPI::TFT_eSPI(int16_t w, int16_t h) resetViewport(); rotation = 0; - cursor_y = cursor_x = 0; + cursor_y = cursor_x = last_cursor_x = bg_cursor_x = 0; textfont = 1; textsize = 1; textcolor = bitmap_fg = 0xFFFF; // White textbgcolor = bitmap_bg = 0x0000; // Black - padX = 0; // No padding + padX = 0; // No padding + + _fillbg = false; // Smooth font only at the moment, force text background fill + isDigits = false; // No bounding box adjustment textwrapX = true; // Wrap text at end of line when using print stream textwrapY = false; // Wrap text at bottom of screen when using print stream @@ -2723,10 +2726,14 @@ void TFT_eSPI::setTextColor(uint16_t c) ** Function name: setTextColor ** Description: Set the font foreground and background colour ***************************************************************************************/ -void TFT_eSPI::setTextColor(uint16_t c, uint16_t b) +// Smooth fonts use the background colour for anti-aliasing and by default the +// background is not filled. If bgfill = true, then a smooth font background fill will +// be used. +void TFT_eSPI::setTextColor(uint16_t c, uint16_t b, bool bgfill) { textcolor = c; textbgcolor = b; + _fillbg = bgfill; } @@ -3180,6 +3187,12 @@ void TFT_eSPI::setWindow(int32_t x0, int32_t y0, int32_t x1, int32_t y1) // write to RAM DC_C; tft_Write_8(TFT_RAMWR); DC_D; + // Temporary solution is to include the RP2040 code here + #if (defined(ARDUINO_ARCH_RP2040) || defined (ARDUINO_ARCH_MBED)) && !defined(RP2040_PIO_INTERFACE) + // For ILI9225 and RP2040 the slower Arduino SPI transfer calls were used, so need to swap back to 16 bit mode + while (spi_get_hw(SPI_X)->sr & SPI_SSPSR_BSY_BITS) {}; + hw_write_masked(&spi_get_hw(SPI_X)->cr0, (16 - 1) << SPI_SSPCR0_DSS_LSB, SPI_SSPCR0_DSS_BITS); + #endif #elif defined (SSD1351_DRIVER) if (rotation & 1) { swap_coord(x0, y0); @@ -3730,7 +3743,7 @@ uint16_t TFT_eSPI::drawPixel(int32_t x, int32_t y, uint32_t color, uint8_t alpha void TFT_eSPI::fillSmoothCircle(int32_t x, int32_t y, int32_t r, uint32_t color, uint32_t bg_color) { if (r <= 0) return; - + inTransaction = true; drawFastHLine(x - r, y, 2 * r + 1, color); @@ -3786,9 +3799,14 @@ void TFT_eSPI::fillSmoothRoundRect(int32_t x, int32_t y, int32_t w, int32_t h, i int32_t xs = 0; int32_t cx = 0; + // Limit radius to half width or height + if (r > w/2) r = w/2; + if (r > h/2) r = h/2; + y += r; h -= 2*r; - fillRect(x, y, w, h + 1, color); + fillRect(x, y, w, h, color); + h--; x += r; w -= 2*r+1; int32_t r1 = r * r; @@ -4989,17 +5007,6 @@ int16_t TFT_eSPI::drawString(const char *string, int32_t poX, int32_t poY, uint8 #ifdef SMOOTH_FONT if(fontLoaded) { - if (textcolor!=textbgcolor) fillRect(poX, poY, cwidth, cheight, textbgcolor); -/* - // The above only works for a single text line, not if the text is going to wrap... - // So need to use code like this in a while loop to fix it: - if (textwrapX && (cursor_x + width * textsize > width())) { - cursor_y += height; - cursor_x = 0; - } - if (textwrapY && (cursor_y >= (int32_t)height())) cursor_y = 0; - cursor_x += drawChar(uniCode, cursor_x, cursor_y, textfont); -*/ setCursor(poX, poY); while (n < len) { @@ -5312,6 +5319,21 @@ SPIClass& TFT_eSPI::getSPIinstance(void) } #endif + +/*************************************************************************************** +** Function name: verifySetupID +** Description: Compare the ID if USER_SETUP_ID defined in user setup file +***************************************************************************************/ +bool TFT_eSPI::verifySetupID(uint32_t id) +{ +#if defined (USER_SETUP_ID) + if (USER_SETUP_ID == id) return true; +#else + id = id; // Avoid warning +#endif + return false; +} + /*************************************************************************************** ** Function name: getSetup ** Description: Get the setup details for diagnostic and sketch access @@ -5320,6 +5342,18 @@ void TFT_eSPI::getSetup(setup_t &tft_settings) { // tft_settings.version is set in header file +#if defined (USER_SETUP_INFO) + tft_settings.setup_info = USER_SETUP_INFO; +#else + tft_settings.setup_info = "NA"; +#endif + +#if defined (USER_SETUP_ID) + tft_settings.setup_id = USER_SETUP_ID; +#else + tft_settings.setup_id = 0; +#endif + #if defined (PROCESSOR_ID) tft_settings.esp = PROCESSOR_ID; #else @@ -5341,6 +5375,16 @@ void TFT_eSPI::getSetup(setup_t &tft_settings) #ifdef SPI_READ_FREQUENCY tft_settings.tft_rd_freq = SPI_READ_FREQUENCY/100000; #endif + #ifdef TFT_SPI_PORT + tft_settings.port = TFT_SPI_PORT; + #else + tft_settings.port = 255; + #endif + #ifdef RP2040_PIO_SPI + tft_settings.interface = 0x10; + #else + tft_settings.interface = 0x0; + #endif #endif #if defined(TFT_SPI_OVERLAP) diff --git a/TFT_eSPI.h b/TFT_eSPI.h index a4762c4..a03a24d 100644 --- a/TFT_eSPI.h +++ b/TFT_eSPI.h @@ -16,7 +16,7 @@ #ifndef _TFT_eSPIH_ #define _TFT_eSPIH_ -#define TFT_ESPI_VERSION "2.4.45" +#define TFT_ESPI_VERSION "2.4.50" // Bit level feature flags // Bit 0 set: viewport capability @@ -28,7 +28,7 @@ //Standard support #ifdef TFT_eSPI_COMPONENT -#include "TFT_config.h" + #include "TFT_config.h" #endif #include @@ -95,10 +95,12 @@ #endif // Some ST7789 boards do not work with Mode 0 -#if defined(ST7789_DRIVER) || defined(ST7789_2_DRIVER) - #define TFT_SPI_MODE SPI_MODE3 -#else - #define TFT_SPI_MODE SPI_MODE0 +#ifndef TFT_SPI_MODE + #if defined(ST7789_DRIVER) || defined(ST7789_2_DRIVER) + #define TFT_SPI_MODE SPI_MODE3 + #else + #define TFT_SPI_MODE SPI_MODE0 + #endif #endif // If the XPT2046 SPI frequency is not defined, set a default @@ -317,23 +319,15 @@ static const uint16_t default_4bit_palette[] PROGMEM = { typedef struct { String version = TFT_ESPI_VERSION; +String setup_info; // Setup reference name available to use in a user setup +uint32_t setup_id; // ID available to use in a user setup int32_t esp; // Processor code uint8_t trans; // SPI transaction support uint8_t serial; // Serial (SPI) or parallel +uint8_t port; // SPI port uint8_t overlap; // ESP8266 overlap mode -/* -#if defined (ESP32) // TODO: make generic for other processors - #if defined (USE_HSPI_PORT) - uint8_t port = HSPI; - #else - #ifdef CONFIG_IDF_TARGET_ESP32 - uint8_t port = VSPI; - #else - uint8_t port = FSPI; - #endif - #endif -#endif -*/ +uint8_t interface; // Interface type + uint16_t tft_driver; // Hexadecimal code uint16_t tft_width; // Rotation 0 width and height uint16_t tft_height; @@ -583,7 +577,7 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac getCursorY(void); // Read current cursor y position void setTextColor(uint16_t color), // Set character (glyph) color only (background not over-written) - setTextColor(uint16_t fgcolor, uint16_t bgcolor),// Set character (glyph) foreground and backgorund colour + setTextColor(uint16_t fgcolor, uint16_t bgcolor, bool bgfill = false), // Set character (glyph) foreground and background colour, optional background fill for smooth fonts setTextSize(uint8_t size); // Set character size multiplier (this increases pixel size) void setTextWrap(bool wrapX, bool wrapY = false); // Turn on/off wrapping of text in TFT width and/or height @@ -733,6 +727,7 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac // Used for diagnostic sketch to see library setup adopted by compiler, see Section 7 above void getSetup(setup_t& tft_settings); // Sketch provides the instance to populate + bool verifySetupID(uint32_t id); // Global variables static SPIClass& getSPIinstance(void); // Get SPI class handle @@ -835,6 +830,8 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac bool _vpOoB; int32_t cursor_x, cursor_y, padX; // Text cursor x,y and padding setting + int32_t bg_cursor_x; // Background fill cursor + int32_t last_cursor_x; // Previous text cursor position when fill used uint32_t fontsloaded; // Bit field of fonts loaded @@ -854,6 +851,8 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac uint32_t _lastColor; // Buffered value of last colour used + bool _fillbg; // Fill background flag (just for for smooth fonts at the moment) + #if defined (SSD1963_DRIVER) uint16_t Cswap; // Swap buffer for SSD1963 uint8_t r6, g6, b6; // RGB buffer for SSD1963 @@ -868,7 +867,13 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac ***************************************************************************************/ // Load the Touch extension #ifdef TOUCH_CS - #include "Extensions/Touch.h" // Loaded if TOUCH_CS is defined by user + #if defined (TFT_PARALLEL_8_BIT) || defined (RP2040_PIO_INTERFACE) + #error >>>>------>> Touch functions not supported in 8 bit parallel mode or with RP2040 PIO. + #else + #include "Extensions/Touch.h" // Loaded if TOUCH_CS is defined by user + #endif +#else + #warning >>>>------>> TOUCH_CS pin not defined, TFT_eSPI touch functions will not be available! #endif // Load the Anti-aliased font extension diff --git a/Tools/Images/README.md b/Tools/bmp2array4bit/README.md similarity index 100% rename from Tools/Images/README.md rename to Tools/bmp2array4bit/README.md diff --git a/Tools/Images/bmp2array4bit.py b/Tools/bmp2array4bit/bmp2array4bit.py similarity index 100% rename from Tools/Images/bmp2array4bit.py rename to Tools/bmp2array4bit/bmp2array4bit.py diff --git a/Tools/Images/star.bmp b/Tools/bmp2array4bit/star.bmp similarity index 100% rename from Tools/Images/star.bmp rename to Tools/bmp2array4bit/star.bmp diff --git a/User_Setup.h b/User_Setup.h index 34cb119..16ea89e 100644 --- a/User_Setup.h +++ b/User_Setup.h @@ -8,6 +8,8 @@ // run without the need to make any more changes for a particular hardware setup! // Note that some sketches are designed for a particular TFT pixel width/height +// User defined information reported by "Read_User_Setup" test & diagnostics example +#define USER_SETUP_INFO "User_Setup" // ################################################################################## // diff --git a/User_Setups/Setup100_RP2040_ILI9488_parallel.h b/User_Setups/Setup100_RP2040_ILI9488_parallel.h index c4bf8ec..a28fa70 100644 --- a/User_Setups/Setup100_RP2040_ILI9488_parallel.h +++ b/User_Setups/Setup100_RP2040_ILI9488_parallel.h @@ -1,5 +1,6 @@ // This setup is for the RP2040 processor only when used with 8 bit parallel displays // See SetupX_Template.h for all options available +#define USER_SETUP_ID 100 //////////////////////////////////////////////////////////////////////////////////////////// // Interface diff --git a/User_Setups/Setup101_RP2040_ILI9481_parallel.h b/User_Setups/Setup101_RP2040_ILI9481_parallel.h index 9d75f02..f80fdef 100644 --- a/User_Setups/Setup101_RP2040_ILI9481_parallel.h +++ b/User_Setups/Setup101_RP2040_ILI9481_parallel.h @@ -1,5 +1,6 @@ // This setup is for the RP2040 processor only when used with 8 bit parallel displays // See SetupX_Template.h for all options available +#define USER_SETUP_ID 101 //////////////////////////////////////////////////////////////////////////////////////////// // Interface diff --git a/User_Setups/Setup102_RP2040_ILI9341_parallel.h b/User_Setups/Setup102_RP2040_ILI9341_parallel.h index f1e2c1b..844d237 100644 --- a/User_Setups/Setup102_RP2040_ILI9341_parallel.h +++ b/User_Setups/Setup102_RP2040_ILI9341_parallel.h @@ -1,5 +1,6 @@ // This setup is for the RP2040 processor only when used with 8 bit parallel displays // See SetupX_Template.h for all options available +#define USER_SETUP_ID 102 //////////////////////////////////////////////////////////////////////////////////////////// // Interface diff --git a/User_Setups/Setup103_RP2040_ILI9486_parallel.h b/User_Setups/Setup103_RP2040_ILI9486_parallel.h index 5f6daa5..ca2084c 100644 --- a/User_Setups/Setup103_RP2040_ILI9486_parallel.h +++ b/User_Setups/Setup103_RP2040_ILI9486_parallel.h @@ -1,5 +1,6 @@ // This setup is for the RP2040 processor only when used with 8 bit parallel displays // See SetupX_Template.h for all options available +#define USER_SETUP_ID 103 //////////////////////////////////////////////////////////////////////////////////////////// // Interface diff --git a/User_Setups/Setup104_RP2040_ST7796_parallel.h b/User_Setups/Setup104_RP2040_ST7796_parallel.h index b0be06d..0a69d9d 100644 --- a/User_Setups/Setup104_RP2040_ST7796_parallel.h +++ b/User_Setups/Setup104_RP2040_ST7796_parallel.h @@ -1,5 +1,6 @@ // This setup is for the RP2040 processor only when used with 8 bit parallel displays // See SetupX_Template.h for all options available +#define USER_SETUP_ID 104 //////////////////////////////////////////////////////////////////////////////////////////// // Interface diff --git a/User_Setups/Setup10_RPi_touch_ILI9486.h b/User_Setups/Setup10_RPi_touch_ILI9486.h index 452eee8..bde50d3 100644 --- a/User_Setups/Setup10_RPi_touch_ILI9486.h +++ b/User_Setups/Setup10_RPi_touch_ILI9486.h @@ -1,5 +1,6 @@ // For ESP8266 // See SetupX_Template.h for all options available +#define USER_SETUP_ID 10 #define RPI_DISPLAY_TYPE #define ILI9486_DRIVER diff --git a/User_Setups/Setup11_RPi_touch_ILI9486.h b/User_Setups/Setup11_RPi_touch_ILI9486.h index 5f81691..0c9ff18 100644 --- a/User_Setups/Setup11_RPi_touch_ILI9486.h +++ b/User_Setups/Setup11_RPi_touch_ILI9486.h @@ -1,5 +1,7 @@ // For ESP32 // See SetupX_Template.h for all options available +#define USER_SETUP_ID 11 + #define RPI_DISPLAY_TYPE #define ILI9486_DRIVER diff --git a/User_Setups/Setup12_M5Stack_Basic_Core.h b/User_Setups/Setup12_M5Stack_Basic_Core.h index d33f2ff..ff15fff 100644 --- a/User_Setups/Setup12_M5Stack_Basic_Core.h +++ b/User_Setups/Setup12_M5Stack_Basic_Core.h @@ -1,4 +1,5 @@ // See SetupX_Template.h for all options available +#define USER_SETUP_ID 12 //Setup file for the M5Stack Basic Core diff --git a/User_Setups/Setup135_ST7789.h b/User_Setups/Setup135_ST7789.h index e87abad..32f778a 100644 --- a/User_Setups/Setup135_ST7789.h +++ b/User_Setups/Setup135_ST7789.h @@ -1,4 +1,5 @@ // ST7789 135 x 240 display with no chip select line +#define USER_SETUP_ID 135 #define ST7789_DRIVER // Configure all registers diff --git a/User_Setups/Setup136_LilyGo_TTV.h b/User_Setups/Setup136_LilyGo_TTV.h index 0f7c068..d5281d5 100644 --- a/User_Setups/Setup136_LilyGo_TTV.h +++ b/User_Setups/Setup136_LilyGo_TTV.h @@ -1,4 +1,5 @@ // ST7789 135 x 240 display with no chip select line +#define USER_SETUP_ID 136 #define ST7789_DRIVER // Configure all registers diff --git a/User_Setups/Setup137_LilyGo_TDisplay_RP2040.h b/User_Setups/Setup137_LilyGo_TDisplay_RP2040.h index 9b40f53..725a9ce 100644 --- a/User_Setups/Setup137_LilyGo_TDisplay_RP2040.h +++ b/User_Setups/Setup137_LilyGo_TDisplay_RP2040.h @@ -1,4 +1,5 @@ // LilyGo T-Display RP2040 (ST7789 135 x 240 display) +#define USER_SETUP_ID 137 #define ST7789_DRIVER // Configure all registers diff --git a/User_Setups/Setup13_ILI9481_Parallel.h b/User_Setups/Setup13_ILI9481_Parallel.h index 1758420..cf3e412 100644 --- a/User_Setups/Setup13_ILI9481_Parallel.h +++ b/User_Setups/Setup13_ILI9481_Parallel.h @@ -1,4 +1,5 @@ // See SetupX_Template.h for all options available +#define USER_SETUP_ID 13 #define ESP32_PARALLEL diff --git a/User_Setups/Setup14_ILI9341_Parallel.h b/User_Setups/Setup14_ILI9341_Parallel.h index 2fc5cee..b8d134e 100644 --- a/User_Setups/Setup14_ILI9341_Parallel.h +++ b/User_Setups/Setup14_ILI9341_Parallel.h @@ -1,4 +1,5 @@ // See SetupX_Template.h for all options available +#define USER_SETUP_ID 14 #define TFT_PARALLEL_8_BIT diff --git a/User_Setups/Setup15_HX8357D.h b/User_Setups/Setup15_HX8357D.h index 5987451..bc2fc16 100644 --- a/User_Setups/Setup15_HX8357D.h +++ b/User_Setups/Setup15_HX8357D.h @@ -1,4 +1,5 @@ // See SetupX_Template.h for all options available +#define USER_SETUP_ID 15 #define HX8357D_DRIVER diff --git a/User_Setups/Setup16_ILI9488_Parallel.h b/User_Setups/Setup16_ILI9488_Parallel.h index 5d3cb58..f43f69f 100644 --- a/User_Setups/Setup16_ILI9488_Parallel.h +++ b/User_Setups/Setup16_ILI9488_Parallel.h @@ -1,4 +1,5 @@ // See SetupX_Template.h for all options available +#define USER_SETUP_ID 16 #define ESP32_PARALLEL diff --git a/User_Setups/Setup17_ePaper.h b/User_Setups/Setup17_ePaper.h index 86d0e65..c86b08a 100644 --- a/User_Setups/Setup17_ePaper.h +++ b/User_Setups/Setup17_ePaper.h @@ -1,4 +1,5 @@ // See SetupX_Template.h for all options available +#define USER_SETUP_ID 17 #define EPD_DRIVER // ePaper driver diff --git a/User_Setups/Setup18_ST7789.h b/User_Setups/Setup18_ST7789.h index 1f9be03..ba292de 100644 --- a/User_Setups/Setup18_ST7789.h +++ b/User_Setups/Setup18_ST7789.h @@ -1,4 +1,5 @@ // See SetupX_Template.h for all options available +#define USER_SETUP_ID 18 #define ST7789_DRIVER diff --git a/User_Setups/Setup19_RM68140_Parallel.h b/User_Setups/Setup19_RM68140_Parallel.h index 85300ae..3728a7b 100644 --- a/User_Setups/Setup19_RM68140_Parallel.h +++ b/User_Setups/Setup19_RM68140_Parallel.h @@ -1,4 +1,5 @@ // See SetupX_Template.h for all options available +#define USER_SETUP_ID 19 #define ESP32_PARALLEL diff --git a/User_Setups/Setup1_ILI9341.h b/User_Setups/Setup1_ILI9341.h index 82d69c5..1bc3c09 100644 --- a/User_Setups/Setup1_ILI9341.h +++ b/User_Setups/Setup1_ILI9341.h @@ -1,4 +1,5 @@ // See SetupX_Template.h for all options available +#define USER_SETUP_ID 1 #define ILI9341_DRIVER diff --git a/User_Setups/Setup200_GC9A01.h b/User_Setups/Setup200_GC9A01.h index eced7b2..aa34c87 100644 --- a/User_Setups/Setup200_GC9A01.h +++ b/User_Setups/Setup200_GC9A01.h @@ -1,4 +1,5 @@ // See SetupX_Template.h for all options available +#define USER_SETUP_ID 200 #define GC9A01_DRIVER diff --git a/User_Setups/Setup201_WT32_SC01.h b/User_Setups/Setup201_WT32_SC01.h index 80e9cdc..7f03497 100644 --- a/User_Setups/Setup201_WT32_SC01.h +++ b/User_Setups/Setup201_WT32_SC01.h @@ -7,6 +7,7 @@ // If this file is edited correctly then all the library example sketches should // run without the need to make any more changes for a particular hardware setup! // Note that some sketches are designed for a particular TFT pixel width/height +#define USER_SETUP_ID 201 // User defined setup #define ST7796_DRIVER diff --git a/User_Setups/Setup202_SSD1351_128.h b/User_Setups/Setup202_SSD1351_128.h index 947f4d3..793de6c 100644 --- a/User_Setups/Setup202_SSD1351_128.h +++ b/User_Setups/Setup202_SSD1351_128.h @@ -1,4 +1,5 @@ // See SetupX_Template.h for all options available +#define USER_SETUP_ID 202 #define SSD1351_DRIVER diff --git a/User_Setups/Setup203_ST7789.h b/User_Setups/Setup203_ST7789.h index ac77d20..b6acf0c 100644 --- a/User_Setups/Setup203_ST7789.h +++ b/User_Setups/Setup203_ST7789.h @@ -1,4 +1,5 @@ // ST7789 240 x 280 display with no chip select line +#define USER_SETUP_ID 203 #define ST7789_DRIVER // Configure all registers diff --git a/User_Setups/Setup20_ILI9488.h b/User_Setups/Setup20_ILI9488.h index 7d1eaf1..dd4badf 100644 --- a/User_Setups/Setup20_ILI9488.h +++ b/User_Setups/Setup20_ILI9488.h @@ -1,4 +1,5 @@ // See SetupX_Template.h for all options available +#define USER_SETUP_ID 20 #define ILI9488_DRIVER diff --git a/User_Setups/Setup21_ILI9488.h b/User_Setups/Setup21_ILI9488.h index 358eef4..3d2018b 100644 --- a/User_Setups/Setup21_ILI9488.h +++ b/User_Setups/Setup21_ILI9488.h @@ -1,4 +1,5 @@ // See SetupX_Template.h for all options available +#define USER_SETUP_ID 21 #define ILI9488_DRIVER diff --git a/User_Setups/Setup22_TTGO_T4.h b/User_Setups/Setup22_TTGO_T4.h index 31f601e..760b50d 100644 --- a/User_Setups/Setup22_TTGO_T4.h +++ b/User_Setups/Setup22_TTGO_T4.h @@ -1,4 +1,5 @@ // Setup for the TTGO T4 v1.1 ("Bitcoin Tracker") ESP32 board with 2.2" ILI9341 display +#define USER_SETUP_ID 22 // See SetupX_Template.h for all options available @@ -15,6 +16,8 @@ #define TFT_DC 26 // pin 32 for TTGO T4 v1.3 #define TFT_RST 5 +#define TOUCH_CS -1 + #define LOAD_GLCD #define LOAD_FONT2 #define LOAD_FONT4 diff --git a/User_Setups/Setup22_TTGO_T4_v1.3.h b/User_Setups/Setup22_TTGO_T4_v1.3.h index 603bc4e..6658d74 100644 --- a/User_Setups/Setup22_TTGO_T4_v1.3.h +++ b/User_Setups/Setup22_TTGO_T4_v1.3.h @@ -1,4 +1,5 @@ // Setup for the TTGO T4 v1.3 ESP32 board with 2.2" ILI9341 display +#define USER_SETUP_ID 99922 // See SetupX_Template.h for all options available @@ -12,7 +13,7 @@ #define TFT_SCLK 18 #define TFT_CS 27 -#define TFT_DC 32 // pin 26 for TTGO T4 v1.1 +#define TFT_DC 32 // pin 26 for TTGO T4 v1.3 #define TFT_RST 5 #define LOAD_GLCD diff --git a/User_Setups/Setup23_TTGO_TM.h b/User_Setups/Setup23_TTGO_TM.h index f5d9ebb..791348d 100644 --- a/User_Setups/Setup23_TTGO_TM.h +++ b/User_Setups/Setup23_TTGO_TM.h @@ -1,4 +1,5 @@ // Setup for the TTGO TM (Music) ESP32 board with 2.4" ST7789V display +#define USER_SETUP_ID 23 // See SetupX_Template.h for all options available @@ -14,6 +15,8 @@ #define TFT_DC 16 #define TFT_RST 17 +#define TOUCH_CS -1 + #define TFT_WIDTH 240 #define TFT_HEIGHT 320 diff --git a/User_Setups/Setup24_ST7789.h b/User_Setups/Setup24_ST7789.h index 44e4343..2acc6c3 100644 --- a/User_Setups/Setup24_ST7789.h +++ b/User_Setups/Setup24_ST7789.h @@ -1,4 +1,5 @@ // ST7789 240 x 240 display with no chip select line +#define USER_SETUP_ID 24 #define ST7789_DRIVER // Configure all registers diff --git a/User_Setups/Setup25_TTGO_T_Display.h b/User_Setups/Setup25_TTGO_T_Display.h index 50b2447..e0367c5 100644 --- a/User_Setups/Setup25_TTGO_T_Display.h +++ b/User_Setups/Setup25_TTGO_T_Display.h @@ -1,4 +1,5 @@ // Setup for the TTGO T Display +#define USER_SETUP_ID 25 // See SetupX_Template.h for all options available @@ -18,6 +19,8 @@ #define TFT_DC 16 #define TFT_RST 23 +#define TOUCH_CS -1 + #define TFT_BL 4 // Display backlight control pin #define TFT_BACKLIGHT_ON HIGH // HIGH or LOW are options diff --git a/User_Setups/Setup26_TTGO_T_Wristband.h b/User_Setups/Setup26_TTGO_T_Wristband.h index bd35685..3cda1a5 100644 --- a/User_Setups/Setup26_TTGO_T_Wristband.h +++ b/User_Setups/Setup26_TTGO_T_Wristband.h @@ -1,3 +1,5 @@ +#define USER_SETUP_ID 26 + #define ST7735_DRIVER #define TFT_WIDTH 80 diff --git a/User_Setups/Setup27_RPi_ST7796_ESP32.h b/User_Setups/Setup27_RPi_ST7796_ESP32.h index eee4fbc..8d2f54b 100644 --- a/User_Setups/Setup27_RPi_ST7796_ESP32.h +++ b/User_Setups/Setup27_RPi_ST7796_ESP32.h @@ -7,6 +7,8 @@ // If this file is edited correctly then all the library example sketches should // run without the need to make any more changes for a particular hardware setup! +#define USER_SETUP_ID 27 + // ################################################################################## // // Section 0. Call up the right driver file and any options for it diff --git a/User_Setups/Setup28_RPi_ST7796_ESP8266.h b/User_Setups/Setup28_RPi_ST7796_ESP8266.h index 207baa5..4be8274 100644 --- a/User_Setups/Setup28_RPi_ST7796_ESP8266.h +++ b/User_Setups/Setup28_RPi_ST7796_ESP8266.h @@ -6,6 +6,7 @@ // // If this file is edited correctly then all the library example sketches should // run without the need to make any more changes for a particular hardware setup! +#define USER_SETUP_ID 28 // ################################################################################## // diff --git a/User_Setups/Setup29_ILI9341_STM32.h b/User_Setups/Setup29_ILI9341_STM32.h index de612a3..bb78e8e 100644 --- a/User_Setups/Setup29_ILI9341_STM32.h +++ b/User_Setups/Setup29_ILI9341_STM32.h @@ -2,6 +2,7 @@ /////////////////////////////////////////////////// // Setup for STM32 Nucleo and ILI9341 display // /////////////////////////////////////////////////// +#define USER_SETUP_ID 29 // Last update by Bodmer: 28/11/19 diff --git a/User_Setups/Setup2_ST7735.h b/User_Setups/Setup2_ST7735.h index 3832601..aab711b 100644 --- a/User_Setups/Setup2_ST7735.h +++ b/User_Setups/Setup2_ST7735.h @@ -1,4 +1,5 @@ // See SetupX_Template.h for all options available +#define USER_SETUP_ID 2 #define ST7735_DRIVER diff --git a/User_Setups/Setup30_ILI9341_Parallel_STM32.h b/User_Setups/Setup30_ILI9341_Parallel_STM32.h index fbf2847..e9a4221 100644 --- a/User_Setups/Setup30_ILI9341_Parallel_STM32.h +++ b/User_Setups/Setup30_ILI9341_Parallel_STM32.h @@ -1,7 +1,9 @@ //////////////////////////////////////////////////// // Setup for Nucleo 64 or 144 and ILI9341 display // //////////////////////////////////////////////////// - + +#define USER_SETUP_ID 30 + // See SetupX_Template.h for all options available // Define STM32 to invoke optimised processor support diff --git a/User_Setups/Setup31_ST7796_Parallel_STM32.h b/User_Setups/Setup31_ST7796_Parallel_STM32.h index 25675d4..0063e76 100644 --- a/User_Setups/Setup31_ST7796_Parallel_STM32.h +++ b/User_Setups/Setup31_ST7796_Parallel_STM32.h @@ -1,7 +1,7 @@ //////////////////////////////////////////////////// // Setup for Nucleo 64 or 144 and ILI9341 display // //////////////////////////////////////////////////// - +#define USER_SETUP_ID 31 // See SetupX_Template.h for all options available diff --git a/User_Setups/Setup32_ILI9341_STM32F103.h b/User_Setups/Setup32_ILI9341_STM32F103.h index 0be32f7..38a662a 100644 --- a/User_Setups/Setup32_ILI9341_STM32F103.h +++ b/User_Setups/Setup32_ILI9341_STM32F103.h @@ -1,6 +1,7 @@ ////////////////////////////////////////////////////////////// // Setup for STM32F103 (e.g. Blue Pill) and ILI9341 display // ////////////////////////////////////////////////////////////// +#define USER_SETUP_ID 32 // Last update by Bodmer: 14/1/20 diff --git a/User_Setups/Setup33_RPi_ILI9486_STM32.h b/User_Setups/Setup33_RPi_ILI9486_STM32.h index f7a7038..6def91d 100644 --- a/User_Setups/Setup33_RPi_ILI9486_STM32.h +++ b/User_Setups/Setup33_RPi_ILI9486_STM32.h @@ -1,7 +1,7 @@ - /////////////////////////////////////////////////// // Setup for STM32 Nucleo and ILI9341 display // /////////////////////////////////////////////////// +#define USER_SETUP_ID 33 // Last update by Bodmer: 28/11/19 diff --git a/User_Setups/Setup34_ILI9481_Parallel_STM32.h b/User_Setups/Setup34_ILI9481_Parallel_STM32.h index 74e4e19..9585a4f 100644 --- a/User_Setups/Setup34_ILI9481_Parallel_STM32.h +++ b/User_Setups/Setup34_ILI9481_Parallel_STM32.h @@ -1,7 +1,7 @@ //////////////////////////////////////////////////// // Setup for Nucleo 64 or 144 and ILI9341 display // //////////////////////////////////////////////////// - +#define USER_SETUP_ID 34 // See SetupX_Template.h for all options available // Define STM32 to invoke optimised processor support diff --git a/User_Setups/Setup35_ILI9341_STM32_Port_Bus.h b/User_Setups/Setup35_ILI9341_STM32_Port_Bus.h index 9bd88fa..eadec6e 100644 --- a/User_Setups/Setup35_ILI9341_STM32_Port_Bus.h +++ b/User_Setups/Setup35_ILI9341_STM32_Port_Bus.h @@ -1,7 +1,7 @@ ////////////////////////////////////////////////////////////// // Setup for STM32 and ILI9341 display // ////////////////////////////////////////////////////////////// - +#define USER_SETUP_ID 35 // Last update by Bodmer: 28/3/20 // Define STM32 to invoke STM32 optimised driver diff --git a/User_Setups/Setup36_RPi_touch_ST7796.h b/User_Setups/Setup36_RPi_touch_ST7796.h index ad30ca5..865a347 100644 --- a/User_Setups/Setup36_RPi_touch_ST7796.h +++ b/User_Setups/Setup36_RPi_touch_ST7796.h @@ -1,4 +1,5 @@ // See SetupX_Template.h for all options available +#define USER_SETUP_ID 36 #define RPI_DISPLAY_TYPE #define ST7796_DRIVER diff --git a/User_Setups/Setup3_ILI9163.h b/User_Setups/Setup3_ILI9163.h index f9b2656..d228acf 100644 --- a/User_Setups/Setup3_ILI9163.h +++ b/User_Setups/Setup3_ILI9163.h @@ -1,4 +1,5 @@ // See SetupX_Template.h for all options available +#define USER_SETUP_ID 3 #define ILI9163_DRIVER diff --git a/User_Setups/Setup43_ST7735.h b/User_Setups/Setup43_ST7735.h index 520f8c9..4b8b699 100644 --- a/User_Setups/Setup43_ST7735.h +++ b/User_Setups/Setup43_ST7735.h @@ -1,5 +1,5 @@ // Setup for ESP32 and ST7735 80 x 160 TFT - +#define USER_SETUP_ID 43 // See SetupX_Template.h for all options available #define ST7735_DRIVER diff --git a/User_Setups/Setup44_TTGO_CameraPlus.h b/User_Setups/Setup44_TTGO_CameraPlus.h index ba69427..0786918 100644 --- a/User_Setups/Setup44_TTGO_CameraPlus.h +++ b/User_Setups/Setup44_TTGO_CameraPlus.h @@ -1,3 +1,4 @@ +#define USER_SETUP_ID 44 #define ST7789_DRIVER diff --git a/User_Setups/Setup45_TTGO_T_Watch.h b/User_Setups/Setup45_TTGO_T_Watch.h index f4c243e..9a90105 100644 --- a/User_Setups/Setup45_TTGO_T_Watch.h +++ b/User_Setups/Setup45_TTGO_T_Watch.h @@ -1,3 +1,5 @@ +#define USER_SETUP_ID 45 + #define ST7789_DRIVER #define TFT_WIDTH 240 diff --git a/User_Setups/Setup46_GC9A01_ESP32.h b/User_Setups/Setup46_GC9A01_ESP32.h index b24a74d..d289bec 100644 --- a/User_Setups/Setup46_GC9A01_ESP32.h +++ b/User_Setups/Setup46_GC9A01_ESP32.h @@ -1,3 +1,5 @@ +#define USER_SETUP_ID 46 + #define GC9A01_DRIVER #define TFT_MISO 19 diff --git a/User_Setups/Setup47_ST7735.h b/User_Setups/Setup47_ST7735.h index be729ca..d2e996d 100644 --- a/User_Setups/Setup47_ST7735.h +++ b/User_Setups/Setup47_ST7735.h @@ -1,4 +1,5 @@ // Config for two ST7735 128 x 128 displays for Animated_Eyes example +#define USER_SETUP_ID 47 #define ST7735_DRIVER // Configure all registers diff --git a/User_Setups/Setup4_S6D02A1.h b/User_Setups/Setup4_S6D02A1.h index 233117c..a8ce0d3 100644 --- a/User_Setups/Setup4_S6D02A1.h +++ b/User_Setups/Setup4_S6D02A1.h @@ -1,4 +1,5 @@ // See SetupX_Template.h for all options available +#define USER_SETUP_ID 4 #define S6D02A1_DRIVER diff --git a/User_Setups/Setup50_SSD1963_Parallel.h b/User_Setups/Setup50_SSD1963_Parallel.h index 558356b..011fbd1 100644 --- a/User_Setups/Setup50_SSD1963_Parallel.h +++ b/User_Setups/Setup50_SSD1963_Parallel.h @@ -6,7 +6,7 @@ // // If this file is edited correctly then all the library example sketches should // run without the need to make any more changes for a particular hardware setup! - +#define USER_SETUP_ID 50 // ################################################################################## // // Section 0. Call up the right driver file and any options for it diff --git a/User_Setups/Setup51_LilyPi_ILI9481.h b/User_Setups/Setup51_LilyPi_ILI9481.h index 447aee9..444b671 100644 --- a/User_Setups/Setup51_LilyPi_ILI9481.h +++ b/User_Setups/Setup51_LilyPi_ILI9481.h @@ -1,3 +1,5 @@ +#define USER_SETUP_ID 51 + #define ILI9481_DRIVER #define TFT_BL 12 // LED back-light control pin diff --git a/User_Setups/Setup52_LilyPi_ST7796.h b/User_Setups/Setup52_LilyPi_ST7796.h index 28e793a..b6bc8eb 100644 --- a/User_Setups/Setup52_LilyPi_ST7796.h +++ b/User_Setups/Setup52_LilyPi_ST7796.h @@ -1,3 +1,5 @@ +#define USER_SETUP_ID 52 + #define ST7796_DRIVER #define TFT_BL 12 // LED back-light control pin diff --git a/User_Setups/Setup5_RPi_ILI9486.h b/User_Setups/Setup5_RPi_ILI9486.h index ba21c31..2935158 100644 --- a/User_Setups/Setup5_RPi_ILI9486.h +++ b/User_Setups/Setup5_RPi_ILI9486.h @@ -1,4 +1,5 @@ // See SetupX_Template.h for all options available +#define USER_SETUP_ID 5 #define RPI_ILI9486_DRIVER // 20MHz maximum SPI diff --git a/User_Setups/Setup60_RP2040_ILI9341.h b/User_Setups/Setup60_RP2040_ILI9341.h index b8a6bb9..49522e1 100644 --- a/User_Setups/Setup60_RP2040_ILI9341.h +++ b/User_Setups/Setup60_RP2040_ILI9341.h @@ -8,7 +8,7 @@ // run without the need to make any more changes for a particular hardware setup! // Note that some sketches are designed for a particular TFT pixel width/height - +#define USER_SETUP_ID 60 // ################################################################################## // // Section 1. Call up the right driver file and any options for it diff --git a/User_Setups/Setup61_RP2040_ILI9341_PIO_SPI.h b/User_Setups/Setup61_RP2040_ILI9341_PIO_SPI.h index df5e2c0..01fd63f 100644 --- a/User_Setups/Setup61_RP2040_ILI9341_PIO_SPI.h +++ b/User_Setups/Setup61_RP2040_ILI9341_PIO_SPI.h @@ -1,5 +1,5 @@ // Setup file for RP2040 and SPI ILI9341 display using PIO for the display interface - +#define USER_SETUP_ID 61 // The PIO can only be user with Earle Philhower's RP2040 board package: // https://github.com/earlephilhower/arduino-pico diff --git a/User_Setups/Setup62_RP2040_Nano_Connect_ILI9341.h b/User_Setups/Setup62_RP2040_Nano_Connect_ILI9341.h index 30ba4cf..6548062 100644 --- a/User_Setups/Setup62_RP2040_Nano_Connect_ILI9341.h +++ b/User_Setups/Setup62_RP2040_Nano_Connect_ILI9341.h @@ -8,7 +8,7 @@ // run without the need to make any more changes for a particular hardware setup! // Note that some sketches are designed for a particular TFT pixel width/height - +#define USER_SETUP_ID 62 // ################################################################################## // // Section 1. Call up the right driver file and any options for it diff --git a/User_Setups/Setup6_RPi_Wr_ILI9486.h b/User_Setups/Setup6_RPi_Wr_ILI9486.h index abeaddb..63a9391 100644 --- a/User_Setups/Setup6_RPi_Wr_ILI9486.h +++ b/User_Setups/Setup6_RPi_Wr_ILI9486.h @@ -1,4 +1,5 @@ // See SetupX_Template.h for all options available +#define USER_SETUP_ID 6 #define RPI_ILI9486_DRIVER // 20MHz maximum SPI diff --git a/User_Setups/Setup70_ESP32_S2_ILI9341.h b/User_Setups/Setup70_ESP32_S2_ILI9341.h index c58f8f1..6fcad90 100644 --- a/User_Setups/Setup70_ESP32_S2_ILI9341.h +++ b/User_Setups/Setup70_ESP32_S2_ILI9341.h @@ -1,6 +1,6 @@ // Setup for the ESP32 S2 with ILI9341 display // Note SPI DMA with ESP32 S2 is not currently supported - +#define USER_SETUP_ID 70 // See SetupX_Template.h for all options available #define ILI9341_DRIVER diff --git a/User_Setups/Setup71_ESP32_S2_ST7789.h b/User_Setups/Setup71_ESP32_S2_ST7789.h index aaa94a0..0380175 100644 --- a/User_Setups/Setup71_ESP32_S2_ST7789.h +++ b/User_Setups/Setup71_ESP32_S2_ST7789.h @@ -1,6 +1,6 @@ // Setup for the ESP32 S2 with ST7789 display // Note SPI DMA with ESP32 S2 is not currently supported - +#define USER_SETUP_ID 71 // See SetupX_Template.h for all options available #define ST7789_DRIVER // Configure all registers diff --git a/User_Setups/Setup72_ESP32_ST7789_172x320.h b/User_Setups/Setup72_ESP32_ST7789_172x320.h index 19407d0..780d60f 100644 --- a/User_Setups/Setup72_ESP32_ST7789_172x320.h +++ b/User_Setups/Setup72_ESP32_ST7789_172x320.h @@ -1,4 +1,5 @@ // Support for 1.47" 320x172 Round Rectangle Color IPS TFT Display +#define USER_SETUP_ID 71 #define ST7789_DRIVER // Full configuration option, define additional parameters below for this display diff --git a/User_Setups/Setup7_ST7735_128x128.h b/User_Setups/Setup7_ST7735_128x128.h index 828bfc6..b083733 100644 --- a/User_Setups/Setup7_ST7735_128x128.h +++ b/User_Setups/Setup7_ST7735_128x128.h @@ -1,4 +1,5 @@ // See SetupX_Template.h for all options available +#define USER_SETUP_ID 7 #define ST7735_DRIVER diff --git a/User_Setups/Setup8_ILI9163_128x128.h b/User_Setups/Setup8_ILI9163_128x128.h index da42ec3..6df7d32 100644 --- a/User_Setups/Setup8_ILI9163_128x128.h +++ b/User_Setups/Setup8_ILI9163_128x128.h @@ -1,4 +1,5 @@ // See SetupX_Template.h for all options available +#define USER_SETUP_ID 8 #define ILI9163_DRIVER diff --git a/User_Setups/Setup9_ST7735_Overlap.h b/User_Setups/Setup9_ST7735_Overlap.h index 0c42e63..2c7f852 100644 --- a/User_Setups/Setup9_ST7735_Overlap.h +++ b/User_Setups/Setup9_ST7735_Overlap.h @@ -1,4 +1,5 @@ // See SetupX_Template.h for all options available +#define USER_SETUP_ID 9 #define ST7735_DRIVER diff --git a/User_Setups/SetupX_Template.h b/User_Setups/SetupX_Template.h index 398d163..5d369f3 100644 --- a/User_Setups/SetupX_Template.h +++ b/User_Setups/SetupX_Template.h @@ -8,6 +8,7 @@ // run without the need to make any more changes for a particular hardware setup! // Note that some sketches are designed for a particular TFT pixel width/height +#define USER_SETUP_ID 0xFFFFFFFF // ################################################################################## // diff --git a/Tools/ESP32 UNO board mod/ESP32 UNO board mod.jpg b/docs/ESP32 UNO board mod/ESP32 UNO board mod.jpg similarity index 100% rename from Tools/ESP32 UNO board mod/ESP32 UNO board mod.jpg rename to docs/ESP32 UNO board mod/ESP32 UNO board mod.jpg diff --git a/Tools/ESP32 UNO board mod/ESP32 UNO board pinout.jpg b/docs/ESP32 UNO board mod/ESP32 UNO board pinout.jpg similarity index 100% rename from Tools/ESP32 UNO board mod/ESP32 UNO board pinout.jpg rename to docs/ESP32 UNO board mod/ESP32 UNO board pinout.jpg diff --git a/Tools/PlatformIO/Configuring options.txt b/docs/PlatformIO/Configuring options.txt similarity index 100% rename from Tools/PlatformIO/Configuring options.txt rename to docs/PlatformIO/Configuring options.txt diff --git a/Tools/RPi_TFT_Connections.png b/docs/RPi_TFT_connections/RPi_TFT_Connections.png similarity index 100% rename from Tools/RPi_TFT_Connections.png rename to docs/RPi_TFT_connections/RPi_TFT_Connections.png diff --git a/Tools/RPi_TFT_mod.png b/docs/RPi_TFT_connections/RPi_TFT_mod.png similarity index 100% rename from Tools/RPi_TFT_mod.png rename to docs/RPi_TFT_connections/RPi_TFT_mod.png diff --git a/examples/Smooth Fonts/FLASH_Array/Font_Demo_1_Array/Font_Demo_1_Array.ino b/examples/Smooth Fonts/FLASH_Array/Font_Demo_1_Array/Font_Demo_1_Array.ino index 089dd2c..4efff44 100644 --- a/examples/Smooth Fonts/FLASH_Array/Font_Demo_1_Array/Font_Demo_1_Array.ino +++ b/examples/Smooth Fonts/FLASH_Array/Font_Demo_1_Array/Font_Demo_1_Array.ino @@ -119,20 +119,22 @@ void loop() { //tft.fillScreen(TFT_BLACK); // Draw changing numbers - does not work unless a filled rectangle is drawn over the old text - for (int i = 0; i <= 20; i++) + for (int i = 0; i <= 99; i++) { tft.setCursor(50, 50); + tft.setTextColor(TFT_GREEN, TFT_BLACK); // TFT_BLACK is used for anti-aliasing only + // By default background fill is off tft.print(" "); // Overprinting old number with spaces DOES NOT WORK! - tft.setTextColor(TFT_GREEN, TFT_BLACK); tft.setCursor(50, 50); tft.print(i / 10.0, 1); - tft.fillRect (50, 90, 60, 40, TFT_BLACK); // Overprint with a filled rectangle - tft.setTextColor(TFT_GREEN, TFT_BLACK); + // 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); tft.setCursor(50, 90); tft.print(i / 10.0, 1); - //delay (200); + delay (200); } delay(5000); diff --git a/examples/Smooth Fonts/FLASH_Array/Font_Demo_2_Array/Font_Demo_2_Array.ino b/examples/Smooth Fonts/FLASH_Array/Font_Demo_2_Array/Font_Demo_2_Array.ino index f8fc234..135c6e6 100644 --- a/examples/Smooth Fonts/FLASH_Array/Font_Demo_2_Array/Font_Demo_2_Array.ino +++ b/examples/Smooth Fonts/FLASH_Array/Font_Demo_2_Array/Font_Demo_2_Array.ino @@ -89,7 +89,8 @@ void loop() { tft.fillScreen(TFT_BLACK); - tft.setTextColor(TFT_GREEN, TFT_BLUE); // Change the font colour and the background colour + // The "true" parameter forces background drawing for smooth fonts + tft.setTextColor(TFT_GREEN, TFT_BLUE, true); // Change the font colour and the background colour tft.drawString("36pt font", xpos, ypos); @@ -99,11 +100,14 @@ void loop() { tft.setTextPadding(100); // Draw changing numbers - likely to flicker using this plot method! - for (int i = 0; i <= 20; i++) { + for (int i = 0; i <= 99; i++) { tft.drawFloat(i / 10.0, 1, xpos, ypos); delay (200); } + // Turn off text padding by setting value to 0 + tft.setTextPadding(0); + tft.unloadFont(); // Remove the font to recover memory used delay(5000); @@ -119,7 +123,7 @@ void loop() { tft.fillScreen(TFT_BLACK); - tft.setTextColor(TFT_DARKGREY, TFT_BLACK); + tft.setTextColor(TFT_DARKGREY, TFT_BLACK, false); // Use middle of screen as datum xpos = tft.width() /2; diff --git a/examples/Smooth Fonts/FLASH_Array/Font_Demo_3_Array/Font_Demo_3_Array.ino b/examples/Smooth Fonts/FLASH_Array/Font_Demo_3_Array/Font_Demo_3_Array.ino index 342d671..a15ee44 100644 --- a/examples/Smooth Fonts/FLASH_Array/Font_Demo_3_Array/Font_Demo_3_Array.ino +++ b/examples/Smooth Fonts/FLASH_Array/Font_Demo_3_Array/Font_Demo_3_Array.ino @@ -10,7 +10,7 @@ This sketch uses method 3, the font characters are first plotted in a Sprite, then the Sprite is pushed to the screen. This method is very flexible and the Sprite can be - created, deleted, resized as needed. To render anit-aliased fonts well the Sprite + created, deleted, resized as needed. To render anti-aliased fonts well the Sprite needs to be 16 bit. The fonts will render in 1 bit per pixel sprites but there will then be no anti-aliasing. Using 1 bit per pixel Sprites is however useful to use the extended Unicode range in fonts on mono displays like ePaper. diff --git a/examples/Smooth Fonts/FLASH_Array/Smooth_font_reading_TFT/Smooth_font_reading_TFT.ino b/examples/Smooth Fonts/FLASH_Array/Smooth_font_reading_TFT/Smooth_font_reading_TFT.ino index e1db0d9..ec6cb73 100644 --- a/examples/Smooth Fonts/FLASH_Array/Smooth_font_reading_TFT/Smooth_font_reading_TFT.ino +++ b/examples/Smooth Fonts/FLASH_Array/Smooth_font_reading_TFT/Smooth_font_reading_TFT.ino @@ -3,7 +3,7 @@ for rendering anti-aliased fonts on an arbitrary background. This is achieved by reading the pixel color at each point on the screen. The TFT must support reading the graphics RAM of the screen memory. This sketch has been tested with - ILI9241 and ILI9481 serial and parallel screens. + ILI9341 and ILI9481 serial and parallel screens. The TFT_eSPI library must be given the name of the function in the sketch that will return the pixel color at a position x,y on the TFT. In this diff --git a/examples/Smooth Fonts/LittleFS/Font_Demo_1/Font_Demo_1.ino b/examples/Smooth Fonts/LittleFS/Font_Demo_1/Font_Demo_1.ino index 7d41d8d..061f0c1 100644 --- a/examples/Smooth Fonts/LittleFS/Font_Demo_1/Font_Demo_1.ino +++ b/examples/Smooth Fonts/LittleFS/Font_Demo_1/Font_Demo_1.ino @@ -140,13 +140,15 @@ void loop() { for (int i = 0; i <= 20; i++) { tft.setCursor(50, 50); + tft.setTextColor(TFT_GREEN, TFT_BLACK); // TFT_BLACK is used for anti-aliasing only + // By default background fill is off tft.print(" "); // Overprinting old number with spaces DOES NOT WORK! - tft.setTextColor(TFT_GREEN, TFT_BLACK); tft.setCursor(50, 50); tft.print(i / 10.0, 1); - tft.fillRect (50, 90, 60, 40, TFT_BLACK); // Overprint with a filled rectangle - tft.setTextColor(TFT_GREEN, TFT_BLACK); + // 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); tft.setCursor(50, 90); tft.print(i / 10.0, 1); diff --git a/examples/Smooth Fonts/LittleFS/Font_Demo_2/Font_Demo_2.ino b/examples/Smooth Fonts/LittleFS/Font_Demo_2/Font_Demo_2.ino index 03ec36f..decef7a 100644 --- a/examples/Smooth Fonts/LittleFS/Font_Demo_2/Font_Demo_2.ino +++ b/examples/Smooth Fonts/LittleFS/Font_Demo_2/Font_Demo_2.ino @@ -108,7 +108,8 @@ void loop() { tft.fillScreen(TFT_BLACK); - tft.setTextColor(TFT_GREEN, TFT_BLUE); // Change the font colour and the background colour + // The "true" parameter forces background drawing for smooth fonts + tft.setTextColor(TFT_GREEN, TFT_BLUE, true); // Change the font colour and the background colour tft.drawString("36pt font", xpos, ypos); @@ -123,6 +124,9 @@ void loop() { delay (200); } + // Turn off text padding by setting value to 0 + tft.setTextPadding(0); + tft.unloadFont(); // Remove the font to recover memory used delay(5000); @@ -138,7 +142,7 @@ void loop() { tft.fillScreen(TFT_BLACK); - tft.setTextColor(TFT_DARKGREY, TFT_BLACK); + tft.setTextColor(TFT_DARKGREY, TFT_BLACK, false); // Use middle of screen as datum xpos = tft.width() /2; diff --git a/examples/Smooth Fonts/SPIFFS/Font_Demo_1/Font_Demo_1.ino b/examples/Smooth Fonts/SPIFFS/Font_Demo_1/Font_Demo_1.ino index f33526b..5b8c781 100644 --- a/examples/Smooth Fonts/SPIFFS/Font_Demo_1/Font_Demo_1.ino +++ b/examples/Smooth Fonts/SPIFFS/Font_Demo_1/Font_Demo_1.ino @@ -141,13 +141,15 @@ void loop() { for (int i = 0; i <= 20; i++) { tft.setCursor(50, 50); + tft.setTextColor(TFT_GREEN, TFT_BLACK); // TFT_BLACK is used for anti-aliasing only + // By default background fill is off tft.print(" "); // Overprinting old number with spaces DOES NOT WORK! - tft.setTextColor(TFT_GREEN, TFT_BLACK); tft.setCursor(50, 50); tft.print(i / 10.0, 1); - tft.fillRect (50, 90, 60, 40, TFT_BLACK); // Overprint with a filled rectangle - tft.setTextColor(TFT_GREEN, TFT_BLACK); + // 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); tft.setCursor(50, 90); tft.print(i / 10.0, 1); diff --git a/examples/Smooth Fonts/SPIFFS/Font_Demo_2/Font_Demo_2.ino b/examples/Smooth Fonts/SPIFFS/Font_Demo_2/Font_Demo_2.ino index 55591c0..d3d17de 100644 --- a/examples/Smooth Fonts/SPIFFS/Font_Demo_2/Font_Demo_2.ino +++ b/examples/Smooth Fonts/SPIFFS/Font_Demo_2/Font_Demo_2.ino @@ -109,7 +109,8 @@ void loop() { tft.fillScreen(TFT_BLACK); - tft.setTextColor(TFT_GREEN, TFT_BLUE); // Change the font colour and the background colour + // The "true" parameter forces background drawing for smooth fonts + tft.setTextColor(TFT_GREEN, TFT_BLUE, true); // Change the font colour and the background colour tft.drawString("36pt font", xpos, ypos); @@ -124,6 +125,9 @@ void loop() { delay (200); } + // Turn off text padding by setting value to 0 + tft.setTextPadding(0); + tft.unloadFont(); // Remove the font to recover memory used delay(5000); @@ -139,7 +143,7 @@ void loop() { tft.fillScreen(TFT_BLACK); - tft.setTextColor(TFT_DARKGREY, TFT_BLACK); + tft.setTextColor(TFT_DARKGREY, TFT_BLACK, false); // Use middle of screen as datum xpos = tft.width() /2; diff --git a/library.json b/library.json index 790da7e..bae9906 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "TFT_eSPI", - "version": "2.4.45", + "version": "2.4.50", "keywords": "Arduino, tft, display, ttgo, LilyPi, WT32-SC01, ePaper, display, Pico, RP2040 Nano Connect, RP2040, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9481, ILI9486, ILI9488, ST7789, ST7796, RM68140, SSD1351, SSD1963, ILI9225, HX8357D, GC9A01, R61581", "description": "A TFT and ePaper SPI graphics library with optimisation for Raspberry Pi Pico, RP2040, ESP8266, ESP32 and STM32", "repository": diff --git a/library.properties b/library.properties index d2a6c7f..0143f09 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=TFT_eSPI -version=2.4.45 +version=2.4.50 author=Bodmer maintainer=Bodmer sentence=TFT graphics library for Arduino processors with performance optimisation for RP2040, STM32, ESP8266 and ESP32