mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2025-12-18 23:27:44 +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 <GfxRenderer.h>
|
||||||
|
|
||||||
#include "CrossPointSettings.h"
|
#include "CrossPointSettings.h"
|
||||||
|
#include "SD.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "images/CrossLarge.h"
|
#include "images/CrossLarge.h"
|
||||||
|
|
||||||
void SleepActivity::onEnter() {
|
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 pageWidth = GfxRenderer::getScreenWidth();
|
||||||
const auto pageHeight = GfxRenderer::getScreenHeight();
|
const auto pageHeight = GfxRenderer::getScreenHeight();
|
||||||
|
|
||||||
@ -22,3 +35,16 @@ void SleepActivity::onEnter() {
|
|||||||
|
|
||||||
renderer.displayBuffer(EInkDisplay::HALF_REFRESH);
|
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
|
#pragma once
|
||||||
#include "../Activity.h"
|
#include "../Activity.h"
|
||||||
|
#include "SD.h"
|
||||||
|
|
||||||
class SleepActivity final : public Activity {
|
class SleepActivity final : public Activity {
|
||||||
public:
|
public:
|
||||||
explicit SleepActivity(GfxRenderer& renderer, InputManager& inputManager) : Activity(renderer, inputManager) {}
|
explicit SleepActivity(GfxRenderer& renderer, InputManager& inputManager) : Activity(renderer, inputManager) {}
|
||||||
void onEnter() override;
|
void onEnter() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void renderDefaultSleepScreen();
|
||||||
|
void renderCustomSleepScreen(File file);
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user