From 3ae1007cbe9965c8b18f4ac5c94192a5f9ab2c6a Mon Sep 17 00:00:00 2001 From: jpirnay Date: Wed, 11 Feb 2026 16:25:17 +0100 Subject: [PATCH] fix: chore: make all debug messages uniform (#825) ## Summary * Unify all serial port debug messages ## Additional Context * All messages sent to the serial port now follow the "[timestamp] [origin] payload" format (notable exception framework messages) --- ### AI Usage While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it helps set the right context for reviewers. Did you use AI tools to help write this code? No --- src/RecentBooksStore.cpp | 2 +- src/activities/boot_sleep/SleepActivity.cpp | 14 +++++++------- src/activities/home/RecentBooksActivity.cpp | 2 +- src/activities/reader/EpubReaderActivity.cpp | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/RecentBooksStore.cpp b/src/RecentBooksStore.cpp index 9885fcdb..00d641dd 100644 --- a/src/RecentBooksStore.cpp +++ b/src/RecentBooksStore.cpp @@ -83,7 +83,7 @@ RecentBook RecentBooksStore::getDataFromBook(std::string path) const { lastBookFileName = path.substr(lastSlash + 1); } - Serial.printf("Loading recent book: %s\n", path.c_str()); + Serial.printf("[%lu] [RBS] Loading recent book: %s\n", millis(), path.c_str()); // If epub, try to load the metadata for title/author and cover if (StringUtils::checkFileExtension(lastBookFileName, ".epub")) { diff --git a/src/activities/boot_sleep/SleepActivity.cpp b/src/activities/boot_sleep/SleepActivity.cpp index 846df22d..83e68d3d 100644 --- a/src/activities/boot_sleep/SleepActivity.cpp +++ b/src/activities/boot_sleep/SleepActivity.cpp @@ -218,12 +218,12 @@ void SleepActivity::renderCoverSleepScreen() const { // Handle XTC file Xtc lastXtc(APP_STATE.openEpubPath, "/.crosspoint"); if (!lastXtc.load()) { - Serial.println("[SLP] Failed to load last XTC"); + Serial.printf("[%lu] [SLP] Failed to load last XTC\n", millis()); return (this->*renderNoCoverSleepScreen)(); } if (!lastXtc.generateCoverBmp()) { - Serial.println("[SLP] Failed to generate XTC cover bmp"); + Serial.printf("[%lu] [SLP] Failed to generate XTC cover bmp\n", millis()); return (this->*renderNoCoverSleepScreen)(); } @@ -232,12 +232,12 @@ void SleepActivity::renderCoverSleepScreen() const { // Handle TXT file - looks for cover image in the same folder Txt lastTxt(APP_STATE.openEpubPath, "/.crosspoint"); if (!lastTxt.load()) { - Serial.println("[SLP] Failed to load last TXT"); + Serial.printf("[%lu] [SLP] Failed to load last TXT\n", millis()); return (this->*renderNoCoverSleepScreen)(); } if (!lastTxt.generateCoverBmp()) { - Serial.println("[SLP] No cover image found for TXT file"); + Serial.printf("[%lu] [SLP] No cover image found for TXT file\n", millis()); return (this->*renderNoCoverSleepScreen)(); } @@ -247,12 +247,12 @@ void SleepActivity::renderCoverSleepScreen() const { Epub lastEpub(APP_STATE.openEpubPath, "/.crosspoint"); // Skip loading css since we only need metadata here if (!lastEpub.load(true, true)) { - Serial.println("[SLP] Failed to load last epub"); + Serial.printf("[%lu] [SLP] Failed to load last epub\n", millis()); return (this->*renderNoCoverSleepScreen)(); } if (!lastEpub.generateCoverBmp(cropped)) { - Serial.println("[SLP] Failed to generate cover bmp"); + Serial.printf("[%lu] [SLP] Failed to generate cover bmp\n", millis()); return (this->*renderNoCoverSleepScreen)(); } @@ -265,7 +265,7 @@ void SleepActivity::renderCoverSleepScreen() const { if (Storage.openFileForRead("SLP", coverBmpPath, file)) { Bitmap bitmap(file); if (bitmap.parseHeaders() == BmpReaderError::Ok) { - Serial.printf("[SLP] Rendering sleep cover: %s\n", coverBmpPath.c_str()); + Serial.printf("[%lu] [SLP] Rendering sleep cover: %s\n", millis(), coverBmpPath.c_str()); renderBitmapSleepScreen(bitmap); return; } diff --git a/src/activities/home/RecentBooksActivity.cpp b/src/activities/home/RecentBooksActivity.cpp index 657d05c9..2301cbc4 100644 --- a/src/activities/home/RecentBooksActivity.cpp +++ b/src/activities/home/RecentBooksActivity.cpp @@ -73,7 +73,7 @@ void RecentBooksActivity::loop() { if (mappedInput.wasReleased(MappedInputManager::Button::Confirm)) { if (!recentBooks.empty() && selectorIndex < static_cast(recentBooks.size())) { - Serial.printf("Selected recent book: %s\n", recentBooks[selectorIndex].path.c_str()); + Serial.printf("[%lu] [RBA] Selected recent book: %s\n", millis(), recentBooks[selectorIndex].path.c_str()); onSelectBook(recentBooks[selectorIndex].path); return; } diff --git a/src/activities/reader/EpubReaderActivity.cpp b/src/activities/reader/EpubReaderActivity.cpp index fb68d62b..8b2e47e2 100644 --- a/src/activities/reader/EpubReaderActivity.cpp +++ b/src/activities/reader/EpubReaderActivity.cpp @@ -664,9 +664,9 @@ void EpubReaderActivity::saveProgress(int spineIndex, int currentPage, int pageC data[5] = (pageCount >> 8) & 0xFF; f.write(data, 6); f.close(); - Serial.printf("[ERS] Progress saved: Chapter %d, Page %d\n", spineIndex, currentPage); + Serial.printf("[%lu] [ERS] Progress saved: Chapter %d, Page %d\n", millis(), spineIndex, currentPage); } else { - Serial.printf("[ERS] Could not save progress!\n"); + Serial.printf("[%lu] [ERS] Could not save progress!\n", millis()); } } void EpubReaderActivity::renderContents(std::unique_ptr page, const int orientedMarginTop,