Correct #400 and #402 + other tweaks

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:
Bodmer committed 2019-07-30 15:56:55 +01:00
1 parent af4a96a47a
commit 00bf69fc48
7 files changed
+28 -14

No files matched your search

+13 -6
View File
@@ -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
else str_width += pgm_read_byte( widthtable + 32); // Set illegal character = space width
}
if ((font == 2) && (str_width > 0)) str_width--;
}
else
{
@@ -4342,23 +4342,24 @@ int16_t TFT_eSPI::drawChar(uint16_t uniCode, int32_t x, int32_t y, uint8_t font)
{
spi_begin();
setWindow(x, y, (x + w * 8) - 1, y + height - 1);
setWindow(x, y, x + width - 1, y + height - 1);
uint8_t mask;
for (int32_t i = 0; i < height; i++)
{
pX = width;
for (int32_t k = 0; k < w; k++)
{
line = pgm_read_byte((uint8_t *)flash_address + w * i + k);
pX = x + k * 8;
line = pgm_read_byte((uint8_t *) (flash_address + w * i + k) );
mask = 0x80;
while (mask) {
while (mask && pX) {
if (line & mask) {tft_Write_16(textcolor);}
else {tft_Write_16(textbgcolor);}
pX--;
mask = mask >> 1;
}
}
pY += textsize;
if (pX) {tft_Write_16(textbgcolor);}
}
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)
{
if (f == nullptr) // Fix issue #400 (ESP32 crash)
{
setTextFont(1); // Use GLCD font
return;
}
textfont = 1;
gfxFont = (GFXfont *)f;