Simplify boot and sleep screens

This commit is contained in:
Dave Allie 2025-12-08 03:22:50 +11:00
parent d3743185e7
commit 9cff6d3c1f
No known key found for this signature in database
GPG Key ID: F2FDDB3AD8D0276F
6 changed files with 26 additions and 2537 deletions

View File

@ -204,6 +204,13 @@ void EpdRenderer::clearScreen(const uint8_t color) const {
einkDisplay.clearScreen(color);
}
void EpdRenderer::invertScreen() const {
uint8_t *buffer = einkDisplay.getFrameBuffer();
for (int i = 0; i < EInkDisplay::BUFFER_SIZE; i++) {
buffer[i] = ~buffer[i];
}
}
void EpdRenderer::flushDisplay(const EInkDisplay::RefreshMode refreshMode) const {
einkDisplay.displayBuffer(refreshMode);
}

View File

@ -37,6 +37,9 @@ class EpdRenderer {
void copyGrayscaleMsbBuffers() const;
void displayGrayBuffer() const;
void clearScreen(uint8_t color = 0xFF) const;
void invertScreen() const;
void flushDisplay(EInkDisplay::RefreshMode refreshMode = EInkDisplay::FAST_REFRESH) const;
void flushArea(int x, int y, int width, int height) const;

View File

@ -1,7 +1,7 @@
#pragma once
#include <cstdint>
extern const uint8_t CrossLarge[] = {
static const uint8_t CrossLarge[] = {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC7, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE3, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x83, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,

File diff suppressed because it is too large Load Diff

View File

@ -11,5 +11,9 @@ void BootLogoScreen::onEnter() {
renderer.clearScreen();
// Location for images is from top right in landscape orientation
renderer.drawImage(CrossLarge, (pageHeight - 128) / 2, (pageWidth - 128) / 2, 128, 128);
const int width = renderer.getUiTextWidth("CrossPoint", BOLD);
renderer.drawUiText((pageWidth - width)/ 2, pageHeight / 2 + 100, "CrossPoint", true, BOLD);
const int bootingWidth = renderer.getSmallTextWidth("BOOTING");
renderer.drawSmallText((pageWidth - bootingWidth) / 2, pageHeight / 2 + 125, "BOOTING");
renderer.flushDisplay();
}

View File

@ -2,11 +2,18 @@
#include <EpdRenderer.h>
#include "images/SleepScreenImg.h"
#include "images/CrossLarge.h"
void SleepScreen::onEnter() {
const auto pageWidth = renderer.getPageWidth();
const auto pageHeight = renderer.getPageHeight();
renderer.clearScreen();
renderer.flushDisplay();
renderer.drawImageNoMargin(SleepScreenImg, 0, 0, 800, 480);
renderer.flushDisplay();
renderer.drawImage(CrossLarge, (pageHeight - 128) / 2, (pageWidth - 128) / 2, 128, 128);
const int width = renderer.getUiTextWidth("CrossPoint", BOLD);
renderer.drawUiText((pageWidth - width)/ 2, pageHeight / 2 + 100, "CrossPoint", true, BOLD);
const int bootingWidth = renderer.getSmallTextWidth("SLEEPING");
renderer.drawSmallText((pageWidth - bootingWidth) / 2, pageHeight / 2 + 125, "SLEEPING");
renderer.invertScreen();
renderer.flushDisplay(EInkDisplay::HALF_REFRESH);
}