Maintain clock frame when switching between Clock Faces

This commit is contained in:
Jason P 2025-06-24 14:46:40 -05:00
parent cea5cd171a
commit 7a285cf221
3 changed files with 9 additions and 2 deletions

View File

@ -930,6 +930,11 @@ void Screen::setFrames(FrameFocus focus)
// If no module requested focus, will show the first frame instead
ui->switchToFrame(fsi.positions.focusedModule);
break;
case FOCUS_CLOCK:
// Whichever frame was marked by MeshModule::requestFocus(), if any
// If no module requested focus, will show the first frame instead
ui->switchToFrame(fsi.positions.clock);
break;
case FOCUS_PRESERVE:
// No more adjustment — force stay on same index

View File

@ -24,6 +24,7 @@ class Screen
FOCUS_FAULT,
FOCUS_TEXTMESSAGE,
FOCUS_MODULE, // Note: target module should call requestFocus(), otherwise no info about which module to focus
FOCUS_CLOCK,
};
explicit Screen(ScanI2C::DeviceAddress, meshtastic_Config_DisplayConfig_OledType, OLEDDISPLAY_GEOMETRY);
@ -208,6 +209,7 @@ class Screen : public concurrency::OSThread
FOCUS_FAULT,
FOCUS_TEXTMESSAGE,
FOCUS_MODULE, // Note: target module should call requestFocus(), otherwise no info about which module to focus
FOCUS_CLOCK,
};
// Regenerate the normal set of frames, focusing a specific frame if requested

View File

@ -104,10 +104,10 @@ void menuHandler::ClockFacePicker()
menuHandler::menuQueue = menuHandler::clock_menu;
} else if (selected == 1) {
graphics::ClockRenderer::digitalWatchFace = true;
screen->setFrames();
screen->setFrames(Screen::FOCUS_CLOCK);
} else {
graphics::ClockRenderer::digitalWatchFace = false;
screen->setFrames();
screen->setFrames(Screen::FOCUS_CLOCK);
}
});
}