mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-06 13:44:46 +00:00
Improvements to Eink Navigation
This commit is contained in:
parent
232d601b14
commit
3d28086f68
@ -1183,14 +1183,35 @@ void UIRenderer::drawNavigationBar(OLEDDisplay *display, OLEDDisplayUiState *sta
|
|||||||
const int totalWidth = (pageEnd - pageStart) * iconSize + (pageEnd - pageStart - 1) * spacing;
|
const int totalWidth = (pageEnd - pageStart) * iconSize + (pageEnd - pageStart - 1) * spacing;
|
||||||
const int xStart = (SCREEN_WIDTH - totalWidth) / 2;
|
const int xStart = (SCREEN_WIDTH - totalWidth) / 2;
|
||||||
|
|
||||||
// Only show bar briefly after switching frames (unless on E-Ink)
|
// Only show bar briefly after switching frames
|
||||||
|
static uint32_t navBarLastShown = 0;
|
||||||
|
static bool cosmeticRefreshDone = false;
|
||||||
|
|
||||||
|
bool navBarVisible = millis() - lastFrameChangeTime <= ICON_DISPLAY_DURATION_MS;
|
||||||
|
int y = navBarVisible ? (SCREEN_HEIGHT - iconSize - 1) : SCREEN_HEIGHT;
|
||||||
|
|
||||||
#if defined(USE_EINK)
|
#if defined(USE_EINK)
|
||||||
int y = SCREEN_HEIGHT - iconSize - 1;
|
static bool navBarPrevVisible = false;
|
||||||
#else
|
|
||||||
int y = SCREEN_HEIGHT - iconSize - 1;
|
if (navBarVisible && !navBarPrevVisible) {
|
||||||
if (millis() - lastFrameChangeTime > ICON_DISPLAY_DURATION_MS) {
|
EINK_ADD_FRAMEFLAG(display, DEMAND_FAST); // Fast refresh when showing nav bar
|
||||||
y = SCREEN_HEIGHT;
|
cosmeticRefreshDone = false;
|
||||||
|
navBarLastShown = millis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!navBarVisible && navBarPrevVisible) {
|
||||||
|
EINK_ADD_FRAMEFLAG(display, DEMAND_FAST); // Fast refresh when hiding nav bar
|
||||||
|
navBarLastShown = millis(); // Mark when it disappeared
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!navBarVisible && navBarLastShown != 0 && !cosmeticRefreshDone) {
|
||||||
|
if (millis() - navBarLastShown > 10000) { // 10s after hidden
|
||||||
|
EINK_ADD_FRAMEFLAG(display, COSMETIC); // One-time ghost cleanup
|
||||||
|
cosmeticRefreshDone = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
navBarPrevVisible = navBarVisible;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Pre-calculate bounding rect
|
// Pre-calculate bounding rect
|
||||||
|
Loading…
Reference in New Issue
Block a user