From 127b0b9feae4b4c8d8894465f6c2410790210859 Mon Sep 17 00:00:00 2001 From: Sam Davis Date: Sun, 14 Dec 2025 15:06:05 +1100 Subject: [PATCH] add separate render path when sleep.bmp is found in root of sd card --- src/activities/boot_sleep/SleepActivity.cpp | 26 +++++++++++++++++++++ src/activities/boot_sleep/SleepActivity.h | 5 ++++ 2 files changed, 31 insertions(+) diff --git a/src/activities/boot_sleep/SleepActivity.cpp b/src/activities/boot_sleep/SleepActivity.cpp index 2abe91e..2ca877e 100644 --- a/src/activities/boot_sleep/SleepActivity.cpp +++ b/src/activities/boot_sleep/SleepActivity.cpp @@ -3,10 +3,23 @@ #include #include "CrossPointSettings.h" +#include "SD.h" #include "config.h" #include "images/CrossLarge.h" void SleepActivity::onEnter() { + // Look for sleep.bmp on the root of the sd card to determine if we should + // render a custom sleep screen instead of the default. + auto file = SD.open("/sleep.bmp"); + if (file) { + renderCustomSleepScreen(file); + return; + } + + renderDefaultSleepScreen(); +} + +void SleepActivity::renderDefaultSleepScreen() { const auto pageWidth = GfxRenderer::getScreenWidth(); const auto pageHeight = GfxRenderer::getScreenHeight(); @@ -22,3 +35,16 @@ void SleepActivity::onEnter() { renderer.displayBuffer(EInkDisplay::HALF_REFRESH); } + +void SleepActivity::renderCustomSleepScreen(File file) { + Serial.println("Rendering custom sleep screen from sleep.bmp"); + + const auto pageWidth = GfxRenderer::getScreenWidth(); + const auto pageHeight = GfxRenderer::getScreenHeight(); + + renderer.clearScreen(); + + renderer.drawCenteredText(UI_FONT_ID, pageHeight / 2 + 70, "CUSTOM SLEEP SCREEN", true, BOLD); + + renderer.displayBuffer(EInkDisplay::HALF_REFRESH); +} \ No newline at end of file diff --git a/src/activities/boot_sleep/SleepActivity.h b/src/activities/boot_sleep/SleepActivity.h index 1626481..7e86c4c 100644 --- a/src/activities/boot_sleep/SleepActivity.h +++ b/src/activities/boot_sleep/SleepActivity.h @@ -1,8 +1,13 @@ #pragma once #include "../Activity.h" +#include "SD.h" class SleepActivity final : public Activity { public: explicit SleepActivity(GfxRenderer& renderer, InputManager& inputManager) : Activity(renderer, inputManager) {} void onEnter() override; + + private: + void renderDefaultSleepScreen(); + void renderCustomSleepScreen(File file); };