Free Heap when not on Message screen

This commit is contained in:
HarukiToreda
2025-10-15 03:06:59 -04:00
parent 62eaabc940
commit c8f3cbb0f9
5 changed files with 35 additions and 9 deletions

View File

@@ -209,8 +209,19 @@ void resetScrollState()
scrollStartDelay = millis();
lastTime = millis();
didReset = false; // <-- now valid
didReset = false;
}
// Fully free cached message data from heap
void clearMessageCache()
{
std::vector<std::string>().swap(cachedLines);
std::vector<int>().swap(cachedHeights);
// Reset scroll so we rebuild cleanly next time we enter the screen
resetScrollState();
}
// Current thread state
static ThreadMode currentMode = ThreadMode::ALL;
static int currentChannel = -1;