mirror of
https://github.com/Bodmer/TFT_eSPI.git
synced 2025-08-11 00:24:44 +02:00
Corrected font 2 rendering issue #402 Corrected NULL pointer issue #400 Changed grave ` character (key for this character is left of numeral 1 key) to degree symbol in font 2 Change setup24 so DC pin is not D3
This commit is contained in:
@@ -1679,7 +1679,7 @@ int16_t TFT_eSprite::drawChar(uint16_t uniCode, int32_t x, int32_t y, uint8_t fo
|
|||||||
if ((font>2) && (font<9))
|
if ((font>2) && (font<9))
|
||||||
{
|
{
|
||||||
// This is slower than above but is more convenient for the RLE fonts
|
// This is slower than above but is more convenient for the RLE fonts
|
||||||
flash_address = pgm_read_dword( (const void*)pgm_read_dword( &(fontdata[font].chartbl ) ) + uniCode*sizeof(void *) );
|
flash_address = pgm_read_dword( (const void*) (pgm_read_dword( &(fontdata[font].chartbl ) ) + uniCode*sizeof(void *)) );
|
||||||
width = pgm_read_byte( (uint8_t *)pgm_read_dword( &(fontdata[font].widthtbl ) ) + uniCode );
|
width = pgm_read_byte( (uint8_t *)pgm_read_dword( &(fontdata[font].widthtbl ) ) + uniCode );
|
||||||
height= pgm_read_byte( &fontdata[font].height );
|
height= pgm_read_byte( &fontdata[font].height );
|
||||||
}
|
}
|
||||||
|
@@ -15,7 +15,8 @@ PROGMEM const unsigned char widtbl_f16[96] = // character width table
|
|||||||
8, 4, 8, 8, 7, 10, 8, 8, // char 72 - 79
|
8, 4, 8, 8, 7, 10, 8, 8, // char 72 - 79
|
||||||
8, 8, 8, 8, 8, 8, 8, 10, // char 80 - 87
|
8, 8, 8, 8, 8, 8, 8, 10, // char 80 - 87
|
||||||
8, 8, 8, 4, 7, 4, 7, 9, // char 88 - 95
|
8, 8, 8, 4, 7, 4, 7, 9, // char 88 - 95
|
||||||
4, 7, 7, 7, 7, 7, 6, 7, // char 96 - 103
|
// 4, 7, 7, 7, 7, 7, 6, 7, // char 96 - 103 grave see lines 411-414
|
||||||
|
5, 7, 7, 7, 7, 7, 6, 7, // char 96 - 103 celcius
|
||||||
7, 4, 5, 6, 4, 8, 7, 8, // char 104 - 111
|
7, 4, 5, 6, 4, 8, 7, 8, // char 104 - 111
|
||||||
7, 8, 6, 6, 5, 7, 8, 8, // char 112 - 119
|
7, 8, 6, 6, 5, 7, 8, 8, // char 112 - 119
|
||||||
6, 7, 7, 5, 3, 5, 8, 6 // char 120 - 127
|
6, 7, 7, 5, 3, 5, 8, 6 // char 120 - 127
|
||||||
@@ -407,8 +408,10 @@ PROGMEM const unsigned char chr_f16_5F[32] = // 1 unsigned chars per row
|
|||||||
|
|
||||||
PROGMEM const unsigned char chr_f16_60[16] = // 1 unsigned char per row
|
PROGMEM const unsigned char chr_f16_60[16] = // 1 unsigned char per row
|
||||||
{
|
{
|
||||||
0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, // row 1 - 11
|
// 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, // row 1 - 11 grave
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00 // row 12 - 16
|
// 0x00, 0x00, 0x00, 0x00, 0x00 // row 12 - 16
|
||||||
|
0x00, 0x00, 0x00, 0x60, 0x90, 0x90, 0x60, 0x00, 0x00, 0x00, 0x00, // row 1 - 11 Celcius
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
|
|
||||||
PROGMEM const unsigned char chr_f16_61[16] = // 1 unsigned char per row
|
PROGMEM const unsigned char chr_f16_61[16] = // 1 unsigned char per row
|
||||||
|
19
TFT_eSPI.cpp
19
TFT_eSPI.cpp
@@ -2352,7 +2352,7 @@ int16_t TFT_eSPI::textWidth(const char *string, uint8_t font)
|
|||||||
str_width += pgm_read_byte( widthtable + uniCode); // Normally we need to subtract 32 from uniCode
|
str_width += pgm_read_byte( widthtable + uniCode); // Normally we need to subtract 32 from uniCode
|
||||||
else str_width += pgm_read_byte( widthtable + 32); // Set illegal character = space width
|
else str_width += pgm_read_byte( widthtable + 32); // Set illegal character = space width
|
||||||
}
|
}
|
||||||
if ((font == 2) && (str_width > 0)) str_width--;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -4342,23 +4342,24 @@ int16_t TFT_eSPI::drawChar(uint16_t uniCode, int32_t x, int32_t y, uint8_t font)
|
|||||||
{
|
{
|
||||||
spi_begin();
|
spi_begin();
|
||||||
|
|
||||||
setWindow(x, y, (x + w * 8) - 1, y + height - 1);
|
setWindow(x, y, x + width - 1, y + height - 1);
|
||||||
|
|
||||||
uint8_t mask;
|
uint8_t mask;
|
||||||
for (int32_t i = 0; i < height; i++)
|
for (int32_t i = 0; i < height; i++)
|
||||||
{
|
{
|
||||||
|
pX = width;
|
||||||
for (int32_t k = 0; k < w; k++)
|
for (int32_t k = 0; k < w; k++)
|
||||||
{
|
{
|
||||||
line = pgm_read_byte((uint8_t *)flash_address + w * i + k);
|
line = pgm_read_byte((uint8_t *) (flash_address + w * i + k) );
|
||||||
pX = x + k * 8;
|
|
||||||
mask = 0x80;
|
mask = 0x80;
|
||||||
while (mask) {
|
while (mask && pX) {
|
||||||
if (line & mask) {tft_Write_16(textcolor);}
|
if (line & mask) {tft_Write_16(textcolor);}
|
||||||
else {tft_Write_16(textbgcolor);}
|
else {tft_Write_16(textbgcolor);}
|
||||||
|
pX--;
|
||||||
mask = mask >> 1;
|
mask = mask >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pY += textsize;
|
if (pX) {tft_Write_16(textbgcolor);}
|
||||||
}
|
}
|
||||||
|
|
||||||
spi_end();
|
spi_end();
|
||||||
@@ -4895,6 +4896,12 @@ int16_t TFT_eSPI::drawFloat(float floatNumber, uint8_t dp, int32_t poX, int32_t
|
|||||||
|
|
||||||
void TFT_eSPI::setFreeFont(const GFXfont *f)
|
void TFT_eSPI::setFreeFont(const GFXfont *f)
|
||||||
{
|
{
|
||||||
|
if (f == nullptr) // Fix issue #400 (ESP32 crash)
|
||||||
|
{
|
||||||
|
setTextFont(1); // Use GLCD font
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
textfont = 1;
|
textfont = 1;
|
||||||
gfxFont = (GFXfont *)f;
|
gfxFont = (GFXfont *)f;
|
||||||
|
|
||||||
|
@@ -27,3 +27,6 @@
|
|||||||
|
|
||||||
|
|
||||||
#define SPI_FREQUENCY 27000000
|
#define SPI_FREQUENCY 27000000
|
||||||
|
|
||||||
|
// Optional reduced SPI frequency for reading TFT
|
||||||
|
#define SPI_READ_FREQUENCY 5000000
|
@@ -27,8 +27,9 @@
|
|||||||
|
|
||||||
// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation
|
// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation
|
||||||
#define TFT_CS -1 // Define as not used
|
#define TFT_CS -1 // Define as not used
|
||||||
#define TFT_DC PIN_D3 // Data Command control pin
|
#define TFT_DC PIN_D1 // Data Command control pin
|
||||||
#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
#define TFT_RST PIN_D4 // TFT reset pin (could connect to NodeMCU RST, see next line)
|
||||||
|
//#define TFT_RST -1 // TFT reset pin connect to NodeMCU RST, must also then add 10K pull down to TFT SCK
|
||||||
|
|
||||||
|
|
||||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "TFT_eSPI",
|
"name": "TFT_eSPI",
|
||||||
"version": "1.4.13",
|
"version": "1.4.14",
|
||||||
"keywords": "tft, ePaper, display, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486, ST7789, RM68140",
|
"keywords": "tft, ePaper, display, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486, ST7789, RM68140",
|
||||||
"description": "A TFT and ePaper SPI graphics library for ESP8266 and ESP32",
|
"description": "A TFT and ePaper SPI graphics library for ESP8266 and ESP32",
|
||||||
"repository":
|
"repository":
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
name=TFT_eSPI
|
name=TFT_eSPI
|
||||||
version=1.4.13
|
version=1.4.14
|
||||||
author=Bodmer
|
author=Bodmer
|
||||||
maintainer=Bodmer
|
maintainer=Bodmer
|
||||||
sentence=A fast TFT graphics library for ESP8266 and ESP32 processors for the Arduino IDE
|
sentence=A fast TFT graphics library for ESP8266 and ESP32 processors for the Arduino IDE
|
||||||
|
Reference in New Issue
Block a user