From 1368956a57aaee1fb599b5ea96b373ce2b2105e9 Mon Sep 17 00:00:00 2001 From: Todd Herbert Date: Wed, 26 Mar 2025 16:39:36 +1300 Subject: [PATCH] fix: don't use the full shutdown screen during reboot --- .../niche/InkHUD/Applets/System/Logo/LogoApplet.cpp | 13 +++++++++++++ .../niche/InkHUD/Applets/System/Logo/LogoApplet.h | 1 + src/graphics/niche/InkHUD/Events.cpp | 6 +++--- src/graphics/niche/InkHUD/SystemApplet.h | 2 ++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.cpp b/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.cpp index 4c8b0755f..a669c6d75 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.cpp @@ -108,6 +108,19 @@ void InkHUD::LogoApplet::onShutdown() // This is then drawn by InkHUD::Events::onShutdown, with a blocking FULL update, after InkHUD's flash write is complete } +void InkHUD::LogoApplet::onReboot() +{ + bringToForeground(); + + textLeft = ""; + textRight = ""; + textTitle = "Rebooting..."; + fontTitle = fontSmall; + + inkhud->forceUpdate(Drivers::EInk::FULL, false); + // Perform the update right now, waiting here until complete +} + int32_t InkHUD::LogoApplet::runOnce() { sendToBackground(); diff --git a/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.h b/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.h index cc12bd1ba..3f604baed 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.h +++ b/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.h @@ -25,6 +25,7 @@ class LogoApplet : public SystemApplet, public concurrency::OSThread void onForeground() override; void onBackground() override; void onShutdown() override; + void onReboot() override; protected: int32_t runOnce() override; diff --git a/src/graphics/niche/InkHUD/Events.cpp b/src/graphics/niche/InkHUD/Events.cpp index 666dff1e4..7107d4f59 100644 --- a/src/graphics/niche/InkHUD/Events.cpp +++ b/src/graphics/niche/InkHUD/Events.cpp @@ -111,16 +111,16 @@ int InkHUD::Events::beforeReboot(void *unused) a->onDeactivate(); a->onShutdown(); } - for (Applet *sa : inkhud->systemApplets) { + for (SystemApplet *sa : inkhud->systemApplets) { // Note: no onDeactivate. System applets are always active. - sa->onShutdown(); + sa->onReboot(); } inkhud->persistence->saveSettings(); inkhud->persistence->saveLatestMessage(); // Note: no forceUpdate call here - // Because OSThread will not be given another chance to run before reboot, this means that no display update will occur + // We don't have any final screen to draw, although LogoApplet::onReboot did already display a "rebooting" screen return 0; // No special status to report. Ignored anyway by this Observable } diff --git a/src/graphics/niche/InkHUD/SystemApplet.h b/src/graphics/niche/InkHUD/SystemApplet.h index 0f8ceedc7..7ee47eeb9 100644 --- a/src/graphics/niche/InkHUD/SystemApplet.h +++ b/src/graphics/niche/InkHUD/SystemApplet.h @@ -26,6 +26,8 @@ class SystemApplet : public Applet bool lockRendering = false; // - prevent other applets from being rendered during an update bool lockRequests = false; // - prevent other applets from triggering display updates + virtual void onReboot() { onShutdown(); } // - handle reboot specially + // Other system applets may take precedence over our own system applet though // The order an applet is passed to WindowManager::addSystemApplet determines this hierarchy (added earlier = higher rank)