Fix unwanted cache clearing

This commit is contained in:
jpirnay
2026-05-04 15:54:29 +02:00
parent 3fcf72a02f
commit aeafe42348
+4 -5
View File
@@ -24,6 +24,8 @@ void FontCacheManager::clearCache() {
}
void FontCacheManager::prewarmCache(int fontId, const char* utf8Text, uint8_t styleMask) {
clearCache();
// SD card font prewarm path: prewarm all requested styles in one call
auto sdIt = sdCardFonts_.find(fontId);
if (sdIt != sdCardFonts_.end()) {
@@ -51,11 +53,8 @@ void FontCacheManager::prewarmCache(int fontId, const char* utf8Text, uint8_t st
if (!data || !data->groups) continue;
int missed = fontDecompressor_->prewarmCache(data, utf8Text);
if (missed < 0) {
LOG_DBG("FCM", "prewarmCache: Cache slots full! Clearing and retrying slot allocation.");
clearCache();
missed = fontDecompressor_->prewarmCache(data, utf8Text);
}
if (missed > 0) {
LOG_DBG("FCM", "prewarmCache: Decompressor slots full during style %d!", i);
} else if (missed > 0) {
LOG_DBG("FCM", "prewarmCache: %d glyph(s) not cached for style %d", missed, i);
}
}