mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2025-12-18 15:17:42 +03:00
add separate render path when sleep.bmp is found in root of sd card
This commit is contained in:
parent
063a1df851
commit
127b0b9fea
@ -3,10 +3,23 @@
|
||||
#include <GfxRenderer.h>
|
||||
|
||||
#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);
|
||||
}
|
||||
@ -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);
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user