prevent heap fragmentation

This commit is contained in:
2026-01-11 21:58:52 +01:00
parent da6db59e27
commit aa76dd5780
3 changed files with 40 additions and 58 deletions

View File

@@ -3153,7 +3153,6 @@ int16_t TFT_eSPI::drawString(const char *string, int32_t poX, int32_t poY, uint8
}
}
int8_t xo = 0;
uint16_t len = strlen(string);
@@ -3275,7 +3274,7 @@ int16_t TFT_eSPI::drawFloat(float floatNumber, uint8_t dp, int32_t poX, int32_t
void TFT_eSPI::setTextFont(uint8_t f)
{
textfont = (f > 8) ? 1 : f; // Don't allow font > 8
textfont = (f > 7) ? 1 : f; // Don't allow font > 7
}
SPIClass& TFT_eSPI::getSPIinstance()

View File

@@ -350,8 +350,7 @@ class TFT_eSPI { friend class TFT_eSprite;
uint16_t maxDescent; // Maximum descent found in font
} fontMetrics;
fontMetrics gFonts[8] = {
{ nullptr, 0, 0, 0, 0, 0, 0, 0 },
fontMetrics gFonts[7] = {
{ nullptr, 0, 0, 0, 0, 0, 0, 0 },
{ nullptr, 0, 0, 0, 0, 0, 0, 0 },
{ nullptr, 0, 0, 0, 0, 0, 0, 0 },
@@ -362,13 +361,13 @@ class TFT_eSPI { friend class TFT_eSprite;
};
// These are for the metrics for each individual glyph (so we don't need to seek this in file and waste time)
uint16_t* gUnicode[8] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //UTF-16 code, the codes are searched so do not need to be sequential
uint8_t* gHeight[8] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //cheight
uint8_t* gWidth[8] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //cwidth
uint8_t* gxAdvance[8] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //setWidth
int16_t* gdY[8] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //topExtent
int8_t* gdX[8] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //leftExtent
uint32_t* gBitmap[8] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //file pointer to greyscale bitmap
uint16_t* gUnicode[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //UTF-16 code, the codes are searched so do not need to be sequential
uint8_t* gHeight[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //cheight
uint8_t* gWidth[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //cwidth
uint8_t* gxAdvance[7] = {NULL, NULL, NULL, NULL, NULL, NULL}; //setWidth
int16_t* gdY[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //topExtent
int8_t* gdX[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //leftExtent
uint32_t* gBitmap[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //file pointer to greyscale bitmap
uint8_t getTouchRaw(uint16_t *x, uint16_t *y);
uint16_t getTouchRawZ(void);