mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2025-12-18 07:07:41 +03:00
* First pass at moving to SDK EInkDisplay library * Add 2-bit grayscale text and anti-aliased rendering of text * Render status bar for empty chapters * Refresh screen every 15 pages to avoid ghosting * Simplify boot and sleep screens * Give FileSelectionScreen task more stack memory * Move text around slightly on Boot and Sleep screens * Re-use existing buffer and write to whole screen for 'partial update'
35 lines
1011 B
C++
35 lines
1011 B
C++
#pragma once
|
|
#include <Epub.h>
|
|
#include <Epub/Section.h>
|
|
#include <freertos/FreeRTOS.h>
|
|
#include <freertos/semphr.h>
|
|
#include <freertos/task.h>
|
|
|
|
#include "Screen.h"
|
|
|
|
class EpubReaderScreen final : public Screen {
|
|
Epub* epub;
|
|
Section* section = nullptr;
|
|
TaskHandle_t displayTaskHandle = nullptr;
|
|
SemaphoreHandle_t renderingMutex = nullptr;
|
|
int currentSpineIndex = 0;
|
|
int nextPageNumber = 0;
|
|
int pagesUntilFullRefresh = 0;
|
|
bool updateRequired = false;
|
|
const std::function<void()> onGoHome;
|
|
|
|
static void taskTrampoline(void* param);
|
|
[[noreturn]] void displayTaskLoop();
|
|
void renderScreen();
|
|
void renderContents(const Page *p);
|
|
void renderStatusBar() const;
|
|
|
|
public:
|
|
explicit EpubReaderScreen(EpdRenderer& renderer, InputManager& inputManager, Epub* epub,
|
|
const std::function<void()>& onGoHome)
|
|
: Screen(renderer, inputManager), epub(epub), onGoHome(onGoHome) {}
|
|
void onEnter() override;
|
|
void onExit() override;
|
|
void handleInput() override;
|
|
};
|