From 108cf5720254642fe75d85f0b44e56778c7a5df6 Mon Sep 17 00:00:00 2001 From: Dave Allie Date: Mon, 15 Dec 2025 23:17:23 +1100 Subject: [PATCH] Fix formatting --- lib/Epub/Epub/parsers/ChapterHtmlSlimParser.h | 3 +-- src/CrossPointSettings.cpp | 14 +++++++------- src/CrossPointSettings.h | 4 +--- src/screens/EpubReaderScreen.cpp | 4 ++-- src/screens/FileSelectionScreen.cpp | 3 +-- src/screens/SettingsScreen.cpp | 14 +++++--------- src/screens/SettingsScreen.h | 7 +++---- src/screens/SleepScreen.cpp | 2 +- 8 files changed, 21 insertions(+), 30 deletions(-) diff --git a/lib/Epub/Epub/parsers/ChapterHtmlSlimParser.h b/lib/Epub/Epub/parsers/ChapterHtmlSlimParser.h index 67ed5a1..f656b4a 100644 --- a/lib/Epub/Epub/parsers/ChapterHtmlSlimParser.h +++ b/lib/Epub/Epub/parsers/ChapterHtmlSlimParser.h @@ -47,8 +47,7 @@ class ChapterHtmlSlimParser { public: explicit ChapterHtmlSlimParser(const char* filepath, GfxRenderer& renderer, const int fontId, const float lineCompression, const int marginTop, const int marginRight, - const int marginBottom, const int marginLeft, - const bool extraParagraphSpacing, + const int marginBottom, const int marginLeft, const bool extraParagraphSpacing, const std::function)>& completePageFn) : filepath(filepath), renderer(renderer), diff --git a/src/CrossPointSettings.cpp b/src/CrossPointSettings.cpp index d5de7a9..8d3a40e 100644 --- a/src/CrossPointSettings.cpp +++ b/src/CrossPointSettings.cpp @@ -50,13 +50,13 @@ bool CrossPointSettings::loadFromFile() { // load settings that exist switch (fileSettingsCount) { - case 1: - serialization::readPod(inputFile, whiteSleepScreen); - break; - case 2: - serialization::readPod(inputFile, whiteSleepScreen); - serialization::readPod(inputFile, extraParagraphSpacing); - break; + case 1: + serialization::readPod(inputFile, whiteSleepScreen); + break; + case 2: + serialization::readPod(inputFile, whiteSleepScreen); + serialization::readPod(inputFile, extraParagraphSpacing); + break; } inputFile.close(); diff --git a/src/CrossPointSettings.h b/src/CrossPointSettings.h index 43aba9f..b152eb7 100644 --- a/src/CrossPointSettings.h +++ b/src/CrossPointSettings.h @@ -24,9 +24,7 @@ class CrossPointSettings { ~CrossPointSettings() = default; // Get singleton instance - static CrossPointSettings& getInstance() { - return instance; - } + static CrossPointSettings& getInstance() { return instance; } bool saveToFile() const; bool loadFromFile(); diff --git a/src/screens/EpubReaderScreen.cpp b/src/screens/EpubReaderScreen.cpp index e914d07..4a42298 100644 --- a/src/screens/EpubReaderScreen.cpp +++ b/src/screens/EpubReaderScreen.cpp @@ -205,8 +205,8 @@ void EpubReaderScreen::renderScreen() { const auto filepath = epub->getSpineItem(currentSpineIndex); Serial.printf("[%lu] [ERS] Loading file: %s, index: %d\n", millis(), filepath.c_str(), currentSpineIndex); section = std::unique_ptr
(new Section(epub, currentSpineIndex, renderer)); - if (!section->loadCacheMetadata(READER_FONT_ID, lineCompression, marginTop, marginRight, marginBottom, - marginLeft, SETTINGS.extraParagraphSpacing)) { + if (!section->loadCacheMetadata(READER_FONT_ID, lineCompression, marginTop, marginRight, marginBottom, marginLeft, + SETTINGS.extraParagraphSpacing)) { Serial.printf("[%lu] [ERS] Cache not found, building...\n", millis()); { diff --git a/src/screens/FileSelectionScreen.cpp b/src/screens/FileSelectionScreen.cpp index c006ba7..09f2efc 100644 --- a/src/screens/FileSelectionScreen.cpp +++ b/src/screens/FileSelectionScreen.cpp @@ -129,8 +129,7 @@ void FileSelectionScreen::render() const { renderer.drawCenteredText(READER_FONT_ID, 10, "CrossPoint Reader", true, BOLD); // Help text - renderer.drawText(SMALL_FONT_ID, 20, GfxRenderer::getScreenHeight() - 30, - "Press BACK for Settings"); + renderer.drawText(SMALL_FONT_ID, 20, GfxRenderer::getScreenHeight() - 30, "Press BACK for Settings"); if (files.empty()) { renderer.drawText(UI_FONT_ID, 20, 60, "No EPUBs found"); diff --git a/src/screens/SettingsScreen.cpp b/src/screens/SettingsScreen.cpp index da744b9..3e809ce 100644 --- a/src/screens/SettingsScreen.cpp +++ b/src/screens/SettingsScreen.cpp @@ -8,9 +8,8 @@ // Define the static settings list const SettingInfo SettingsScreen::settingsList[SettingsScreen::settingsCount] = { - {"White Sleep Screen", &CrossPointSettings::whiteSleepScreen}, - {"Extra Paragraph Spacing", &CrossPointSettings::extraParagraphSpacing} -}; + {"White Sleep Screen", &CrossPointSettings::whiteSleepScreen}, + {"Extra Paragraph Spacing", &CrossPointSettings::extraParagraphSpacing}}; void SettingsScreen::taskTrampoline(void* param) { auto* self = static_cast(param); @@ -20,8 +19,6 @@ void SettingsScreen::taskTrampoline(void* param) { void SettingsScreen::onEnter() { renderingMutex = xSemaphoreCreateMutex(); - - // Reset selection to first item selectedSettingIndex = 0; @@ -55,7 +52,7 @@ void SettingsScreen::handleInput() { // Trigger a redraw of the entire screen updateRequired = true; - return; // Return early to prevent further processing + return; // Return early to prevent further processing } // Check for Back button to exit settings @@ -121,7 +118,7 @@ void SettingsScreen::render() const { // Draw all settings for (int i = 0; i < settingsCount; i++) { - const int settingY = 60 + i * 30; // 30 pixels between settings + const int settingY = 60 + i * 30; // 30 pixels between settings // Draw selection indicator for the selected setting if (i == selectedSettingIndex) { @@ -135,8 +132,7 @@ void SettingsScreen::render() const { } // Draw help text - renderer.drawText(SMALL_FONT_ID, 20, pageHeight - 30, - "Press OK to toggle, BACK to save & exit"); + renderer.drawText(SMALL_FONT_ID, 20, pageHeight - 30, "Press OK to toggle, BACK to save & exit"); // Always use standard refresh for settings screen renderer.displayBuffer(); diff --git a/src/screens/SettingsScreen.h b/src/screens/SettingsScreen.h index c7d6a5e..8de45b8 100644 --- a/src/screens/SettingsScreen.h +++ b/src/screens/SettingsScreen.h @@ -1,9 +1,9 @@ #pragma once -#include #include #include #include +#include #include #include @@ -13,7 +13,7 @@ class CrossPointSettings; // Structure to hold setting information struct SettingInfo { - const char* name; // Display name of the setting + const char* name; // Display name of the setting uint8_t CrossPointSettings::* valuePtr; // Pointer to member in CrossPointSettings }; @@ -34,8 +34,7 @@ class SettingsScreen final : public Screen { void toggleCurrentSetting(); public: - explicit SettingsScreen(GfxRenderer& renderer, InputManager& inputManager, - const std::function& onGoHome) + explicit SettingsScreen(GfxRenderer& renderer, InputManager& inputManager, const std::function& onGoHome) : Screen(renderer, inputManager), onGoHome(onGoHome) {} void onEnter() override; void onExit() override; diff --git a/src/screens/SleepScreen.cpp b/src/screens/SleepScreen.cpp index e1ed0d7..b280125 100644 --- a/src/screens/SleepScreen.cpp +++ b/src/screens/SleepScreen.cpp @@ -2,9 +2,9 @@ #include +#include "CrossPointSettings.h" #include "config.h" #include "images/CrossLarge.h" -#include "CrossPointSettings.h" void SleepScreen::onEnter() { const auto pageWidth = GfxRenderer::getScreenWidth();