diff --git a/lib/Epub/Epub/EpubHtmlParserSlim.h b/lib/Epub/Epub/EpubHtmlParserSlim.h index 971e93f..0169fd8 100644 --- a/lib/Epub/Epub/EpubHtmlParserSlim.h +++ b/lib/Epub/Epub/EpubHtmlParserSlim.h @@ -28,7 +28,7 @@ class EpubHtmlParserSlim { int partWordBufferIndex = 0; std::unique_ptr currentTextBlock = nullptr; std::unique_ptr currentPage = nullptr; - int currentPageNextY = 0; + int16_t currentPageNextY = 0; int fontId; float lineCompression; int marginTop; diff --git a/lib/Epub/Epub/Page.cpp b/lib/Epub/Epub/Page.cpp index 2eda0a1..09abd08 100644 --- a/lib/Epub/Epub/Page.cpp +++ b/lib/Epub/Epub/Page.cpp @@ -3,7 +3,7 @@ #include #include -constexpr uint8_t PAGE_FILE_VERSION = 2; +constexpr uint8_t PAGE_FILE_VERSION = 3; void PageLine::render(GfxRenderer& renderer, const int fontId) { block->render(renderer, fontId, xPos, yPos); } @@ -16,8 +16,8 @@ void PageLine::serialize(std::ostream& os) { } std::unique_ptr PageLine::deserialize(std::istream& is) { - int32_t xPos; - int32_t yPos; + int16_t xPos; + int16_t yPos; serialization::readPod(is, xPos); serialization::readPod(is, yPos); @@ -26,7 +26,7 @@ std::unique_ptr PageLine::deserialize(std::istream& is) { } void Page::render(GfxRenderer& renderer, const int fontId) const { - for (const auto element : elements) { + for (auto& element : elements) { element->render(renderer, fontId); } } diff --git a/lib/Epub/Epub/Page.h b/lib/Epub/Epub/Page.h index f7ff1c7..59333ce 100644 --- a/lib/Epub/Epub/Page.h +++ b/lib/Epub/Epub/Page.h @@ -11,9 +11,9 @@ enum PageElementTag : uint8_t { // represents something that has been added to a page class PageElement { public: - int xPos; - int yPos; - explicit PageElement(const int xPos, const int yPos) : xPos(xPos), yPos(yPos) {} + int16_t xPos; + int16_t yPos; + explicit PageElement(const int16_t xPos, const int16_t yPos) : xPos(xPos), yPos(yPos) {} virtual ~PageElement() = default; virtual void render(GfxRenderer& renderer, int fontId) = 0; virtual void serialize(std::ostream& os) = 0; @@ -24,7 +24,7 @@ class PageLine final : public PageElement { std::shared_ptr block; public: - PageLine(std::shared_ptr block, const int xPos, const int yPos) + PageLine(std::shared_ptr block, const int16_t xPos, const int16_t yPos) : PageElement(xPos, yPos), block(std::move(block)) {} void render(GfxRenderer& renderer, int fontId) override; void serialize(std::ostream& os) override; diff --git a/src/main.cpp b/src/main.cpp index 1b3bfce..f13e21c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -171,11 +171,7 @@ void onGoHome() { } void setup() { - // Begin serial only if USB connected - pinMode(UART0_RXD, INPUT); - if (digitalRead(UART0_RXD) == HIGH) { - Serial.begin(115200); - } + Serial.begin(115200); Serial.printf("[%lu] [ ] Starting CrossPoint version " CROSSPOINT_VERSION "\n", millis());