A fork of https://github.com/crosspoint-reader/crosspoint-reader
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Full screen refresh of EpubReaderScreen every 10 renders

This is done in an effort to minimise ghosting

+13 -5
+12 -5
src/screens/EpubReaderScreen.cpp
··· 5 5 6 6 #include "Battery.h" 7 7 8 + constexpr int PAGES_PER_REFRESH = 10; 8 9 constexpr unsigned long SKIP_CHAPTER_MS = 700; 9 10 10 11 void EpubReaderScreen::taskTrampoline(void* param) { ··· 159 160 renderer->clearScreen(); 160 161 section->renderPage(); 161 162 renderStatusBar(); 162 - renderer->flushDisplay(); 163 + if (pagesUntilFullRefresh <= 1) { 164 + renderer->flushDisplay(false); 165 + pagesUntilFullRefresh = PAGES_PER_REFRESH; 166 + } else { 167 + renderer->flushDisplay(); 168 + pagesUntilFullRefresh--; 169 + } 163 170 164 171 File f = SD.open((epub->getCachePath() + "/progress.bin").c_str(), FILE_WRITE); 165 172 uint8_t data[4]; ··· 176 183 void EpubReaderScreen::renderStatusBar() const { 177 184 const auto pageWidth = renderer->getPageWidth(); 178 185 179 - std::string progress = std::to_string(section->currentPage + 1) + " / " + std::to_string(section->pageCount); 186 + const std::string progress = std::to_string(section->currentPage + 1) + " / " + std::to_string(section->pageCount); 180 187 const auto progressTextWidth = renderer->getSmallTextWidth(progress.c_str()); 181 188 renderer->drawSmallText(pageWidth - progressTextWidth, 765, progress.c_str()); 182 189 183 190 const uint16_t percentage = battery.readPercentage(); 184 - auto percentageText = std::to_string(percentage) + "%"; 191 + const auto percentageText = std::to_string(percentage) + "%"; 185 192 const auto percentageTextWidth = renderer->getSmallTextWidth(percentageText.c_str()); 186 193 renderer->drawSmallText(20, 765, percentageText.c_str()); 187 194 188 195 // 1 column on left, 2 columns on right, 5 columns of battery body 189 196 constexpr int batteryWidth = 15; 190 197 constexpr int batteryHeight = 10; 191 - const int x = 0; 192 - const int y = 772; 198 + constexpr int x = 0; 199 + constexpr int y = 772; 193 200 194 201 // Top line 195 202 renderer->drawLine(x, y, x + batteryWidth - 4, y, 1);
+1
src/screens/EpubReaderScreen.h
··· 14 14 SemaphoreHandle_t sectionMutex = nullptr; 15 15 int currentSpineIndex = 0; 16 16 int nextPageNumber = 0; 17 + int pagesUntilFullRefresh = 0; 17 18 bool updateRequired = false; 18 19 const std::function<void()> onGoHome; 19 20