Don't shift screens when we draw new ones

This commit is contained in:
Jason P 2025-06-12 09:24:47 -05:00
parent 5ae70db247
commit 37ecfaea68

View File

@ -883,6 +883,7 @@ void Screen::setScreensaverFrames(FrameCallback einkScreensaver)
void Screen::setFrames(FrameFocus focus)
{
uint8_t originalPosition = ui->getUiState()->currentFrame;
uint8_t previousFrameCount = framesetInfo.frameCount;
FramesetInfo fsi; // Location of specific frames, for applying focus parameter
LOG_DEBUG("Show standard frames");
@ -1043,10 +1044,13 @@ void Screen::setFrames(FrameFocus focus)
case FOCUS_PRESERVE:
// No more adjustment — force stay on same index
if (originalPosition < fsi.frameCount)
if (previousFrameCount > fsi.frameCount) {
ui->switchToFrame(originalPosition - 1);
} else if (previousFrameCount < fsi.frameCount) {
ui->switchToFrame(originalPosition + 1);
} else {
ui->switchToFrame(originalPosition);
else
ui->switchToFrame(fsi.frameCount - 1);
}
break;
}