mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2025-12-18 15:17:42 +03:00
Simplify boot and sleep screens
This commit is contained in:
parent
d3743185e7
commit
9cff6d3c1f
@ -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);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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
@ -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();
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user