mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2025-12-18 15:17:42 +03:00
Update sleep screen
This commit is contained in:
parent
899caab70c
commit
8679c8f57c
@ -128,8 +128,13 @@ void EpdRenderer::fillCircle(const int x, const int y, const int radius, const u
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EpdRenderer::drawImage(const uint8_t bitmap[], const int x, const int y, const int width, const int height,
|
void EpdRenderer::drawImage(const uint8_t bitmap[], const int x, const int y, const int width, const int height,
|
||||||
const bool invert) const {
|
const bool invert, const bool mirrorY) const {
|
||||||
display->drawImage(bitmap, x + marginLeft, y + marginTop, width, height, invert);
|
drawImageNoMargin(bitmap, x + marginLeft, y + marginTop, width, height, invert, mirrorY);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EpdRenderer::drawImageNoMargin(const uint8_t bitmap[], const int x, const int y, const int width, const int height,
|
||||||
|
const bool invert, const bool mirrorY) const {
|
||||||
|
display->drawImage(bitmap, x, y, width, height, invert, mirrorY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EpdRenderer::clearScreen(const bool black) const {
|
void EpdRenderer::clearScreen(const bool black) const {
|
||||||
|
|||||||
@ -32,7 +32,10 @@ class EpdRenderer {
|
|||||||
void fillRect(int x, int y, int width, int height, uint16_t color = 1) const;
|
void fillRect(int x, int y, int width, int height, uint16_t color = 1) const;
|
||||||
void drawCircle(int x, int y, int radius, uint16_t color = 1) const;
|
void drawCircle(int x, int y, int radius, uint16_t color = 1) const;
|
||||||
void fillCircle(int x, int y, int radius, uint16_t color = 1) const;
|
void fillCircle(int x, int y, int radius, uint16_t color = 1) const;
|
||||||
void drawImage(const uint8_t bitmap[], int x, int y, int width, int height, bool invert = false) const;
|
void drawImage(const uint8_t bitmap[], int x, int y, int width, int height, bool invert = false,
|
||||||
|
bool mirrorY = false) const;
|
||||||
|
void drawImageNoMargin(const uint8_t bitmap[], int x, int y, int width, int height, bool invert = false,
|
||||||
|
bool mirrorY = false) const;
|
||||||
void clearScreen(bool black = false) const;
|
void clearScreen(bool black = false) const;
|
||||||
void flushDisplay(bool partialUpdate = true) const;
|
void flushDisplay(bool partialUpdate = true) const;
|
||||||
void flushArea(int x, int y, int width, int height) const;
|
void flushArea(int x, int y, int width, int height) const;
|
||||||
|
|||||||
2532
src/images/SleepScreenImg.h
Normal file
2532
src/images/SleepScreenImg.h
Normal file
File diff suppressed because it is too large
Load Diff
11
src/main.cpp
11
src/main.cpp
@ -12,6 +12,7 @@
|
|||||||
#include "screens/EpubReaderScreen.h"
|
#include "screens/EpubReaderScreen.h"
|
||||||
#include "screens/FileSelectionScreen.h"
|
#include "screens/FileSelectionScreen.h"
|
||||||
#include "screens/FullScreenMessageScreen.h"
|
#include "screens/FullScreenMessageScreen.h"
|
||||||
|
#include "screens/SleepScreen.h"
|
||||||
|
|
||||||
#define SPI_FQ 40000000
|
#define SPI_FQ 40000000
|
||||||
// Display SPI pins (custom pins for XteinkX4, not hardware SPI defaults)
|
// Display SPI pins (custom pins for XteinkX4, not hardware SPI defaults)
|
||||||
@ -94,7 +95,7 @@ void waitForNoButton() {
|
|||||||
// Enter deep sleep mode
|
// Enter deep sleep mode
|
||||||
void enterDeepSleep() {
|
void enterDeepSleep() {
|
||||||
exitScreen();
|
exitScreen();
|
||||||
enterNewScreen(new FullScreenMessageScreen(renderer, "Sleeping", BOLD, true, false));
|
enterNewScreen(new SleepScreen(renderer));
|
||||||
|
|
||||||
Serial.println("Power button released after a long press. Entering deep sleep.");
|
Serial.println("Power button released after a long press. Entering deep sleep.");
|
||||||
delay(1000); // Allow Serial buffer to empty and display to update
|
delay(1000); // Allow Serial buffer to empty and display to update
|
||||||
@ -135,8 +136,12 @@ void onGoHome() {
|
|||||||
void setup() {
|
void setup() {
|
||||||
setupInputPinModes();
|
setupInputPinModes();
|
||||||
verifyWakeupLongPress();
|
verifyWakeupLongPress();
|
||||||
Serial.begin(115200);
|
|
||||||
Serial.println("Booting...");
|
// Begin serial only if USB connected
|
||||||
|
pinMode(UART0_RXD, INPUT);
|
||||||
|
if (digitalRead(UART0_RXD) == HIGH) {
|
||||||
|
Serial.begin(115200);
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize pins
|
// Initialize pins
|
||||||
pinMode(BAT_GPIO0, INPUT);
|
pinMode(BAT_GPIO0, INPUT);
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <freertos/FreeRTOS.h>
|
#include <freertos/FreeRTOS.h>
|
||||||
#include <freertos/task.h>
|
|
||||||
#include <freertos/semphr.h>
|
#include <freertos/semphr.h>
|
||||||
|
#include <freertos/task.h>
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|||||||
7
src/screens/SleepScreen.cpp
Normal file
7
src/screens/SleepScreen.cpp
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#include "SleepScreen.h"
|
||||||
|
|
||||||
|
#include <EpdRenderer.h>
|
||||||
|
|
||||||
|
#include "images/SleepScreenImg.h"
|
||||||
|
|
||||||
|
void SleepScreen::onEnter() { renderer->drawImageNoMargin(SleepScreenImg, 0, 0, 800, 480, false, true); }
|
||||||
8
src/screens/SleepScreen.h
Normal file
8
src/screens/SleepScreen.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "Screen.h"
|
||||||
|
|
||||||
|
class SleepScreen final : public Screen {
|
||||||
|
public:
|
||||||
|
explicit SleepScreen(EpdRenderer* renderer) : Screen(renderer) {}
|
||||||
|
void onEnter() override;
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue
Block a user