Reduce number of full screen refreshes to once every 20 pages

This commit is contained in:
Dave Allie 2025-12-06 22:12:01 +11:00
parent bb151caee7
commit eceffaa289
No known key found for this signature in database
GPG Key ID: F2FDDB3AD8D0276F
2 changed files with 5 additions and 8 deletions

View File

@ -2,6 +2,7 @@
#include <EpdRenderer.h>
#include <HardwareSerial.h>
#include <expat.h>
#include "Page.h"
#include "htmlEntities.h"
@ -52,8 +53,6 @@ void EpubHtmlParserSlim::startNewTextBlock(const BLOCK_STYLE style) {
currentTextBlock = new TextBlock(style);
}
#include <expat.h>
void XMLCALL EpubHtmlParserSlim::startElement(void* userData, const XML_Char* name, const XML_Char** atts) {
auto* self = static_cast<EpubHtmlParserSlim*>(userData);
(void)atts;
@ -154,11 +153,9 @@ void XMLCALL EpubHtmlParserSlim::endElement(void* userData, const XML_Char* name
// We don't want to flush out content when closing inline tags like <span>.
// Currently this also flushes out on closing <b> and <i> tags, but they are line tags so that shouldn't happen,
// text styling needs to be overhauled to fix it.
const bool shouldBreakText = matches(name, BLOCK_TAGS, NUM_BLOCK_TAGS) ||
matches(name, HEADER_TAGS, NUM_HEADER_TAGS) ||
matches(name, BOLD_TAGS, NUM_BOLD_TAGS) ||
matches(name, ITALIC_TAGS, NUM_ITALIC_TAGS) ||
self->depth == 1;
const bool shouldBreakText =
matches(name, BLOCK_TAGS, NUM_BLOCK_TAGS) || matches(name, HEADER_TAGS, NUM_HEADER_TAGS) ||
matches(name, BOLD_TAGS, NUM_BOLD_TAGS) || matches(name, ITALIC_TAGS, NUM_ITALIC_TAGS) || self->depth == 1;
if (shouldBreakText) {
self->partWordBuffer[self->partWordBufferIndex] = '\0';

View File

@ -5,7 +5,7 @@
#include "Battery.h"
constexpr int PAGES_PER_REFRESH = 10;
constexpr int PAGES_PER_REFRESH = 20;
constexpr unsigned long SKIP_CHAPTER_MS = 700;
void EpubReaderScreen::taskTrampoline(void* param) {