fix: prevent Serial.printf from blocking when USB disconnected
All checks were successful
CI / build (push) Successful in 2m23s
All checks were successful
CI / build (push) Successful in 2m23s
On ESP32-C3 with USB CDC, Serial.printf() blocks indefinitely when USB is not connected. This caused device freezes when booted without USB. Solution: Call Serial.setTxTimeoutMs(0) after Serial.begin() to make all Serial output non-blocking. Also added if (Serial) guards to high-traffic logging paths in EpubReaderActivity as belt-and-suspenders protection. Includes documentation of the debugging process and Serial call inventory. Also applies clang-format to fix pre-existing formatting issues.
This commit is contained in:
@@ -8,18 +8,10 @@
|
||||
namespace {
|
||||
constexpr int MENU_ITEM_COUNT = 4;
|
||||
const char* MENU_ITEMS[MENU_ITEM_COUNT] = {"Dictionary", "Bookmark", "Clear Cache", "Settings"};
|
||||
const char* MENU_DESCRIPTIONS_ADD[MENU_ITEM_COUNT] = {
|
||||
"Look up a word",
|
||||
"Add bookmark to this page",
|
||||
"Free up storage space",
|
||||
"Open settings menu"
|
||||
};
|
||||
const char* MENU_DESCRIPTIONS_REMOVE[MENU_ITEM_COUNT] = {
|
||||
"Look up a word",
|
||||
"Remove bookmark from this page",
|
||||
"Free up storage space",
|
||||
"Open settings menu"
|
||||
};
|
||||
const char* MENU_DESCRIPTIONS_ADD[MENU_ITEM_COUNT] = {"Look up a word", "Add bookmark to this page",
|
||||
"Free up storage space", "Open settings menu"};
|
||||
const char* MENU_DESCRIPTIONS_REMOVE[MENU_ITEM_COUNT] = {"Look up a word", "Remove bookmark from this page",
|
||||
"Free up storage space", "Open settings menu"};
|
||||
} // namespace
|
||||
|
||||
void QuickMenuActivity::taskTrampoline(void* param) {
|
||||
@@ -121,7 +113,7 @@ void QuickMenuActivity::render() const {
|
||||
|
||||
const auto pageWidth = renderer.getScreenWidth();
|
||||
const auto pageHeight = renderer.getScreenHeight();
|
||||
|
||||
|
||||
// Get bezel offsets
|
||||
const int bezelTop = renderer.getBezelOffsetTop();
|
||||
const int bezelLeft = renderer.getBezelOffsetLeft();
|
||||
@@ -160,7 +152,7 @@ void QuickMenuActivity::render() const {
|
||||
if (i == 1) {
|
||||
itemText = isPageBookmarked ? "Remove Bookmark" : "Add Bookmark";
|
||||
}
|
||||
|
||||
|
||||
renderer.drawText(UI_10_FONT_ID, marginLeft + 20, itemY, itemText, !isSelected);
|
||||
renderer.drawText(SMALL_FONT_ID, marginLeft + 20, itemY + 22, descriptions[i], !isSelected);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user