fix: Defer low-power mode during section indexing and book loading
Prevent the device from dropping to 10MHz CPU during first-time chapter indexing, cover prerendering, and other CPU-intensive reader operations. Three issues addressed: - ActivityWithSubactivity now delegates preventAutoSleep() and skipLoopDelay() to the active subactivity, so EpubReaderActivity's signal is visible through the ReaderActivity wrapper - Added post-loop() re-check of preventAutoSleep() in main.cpp to catch activity transitions that happen mid-loop - EpubReaderActivity uses both !section and a loadingSection flag to cover the full duration from activity entry through section file creation; TxtReaderActivity uses !initialized similarly Also syncs HalPowerManager.cpp log messages with upstream PR #852. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -861,6 +861,8 @@ void EpubReaderActivity::renderScreen() {
|
||||
}
|
||||
|
||||
if (!section) {
|
||||
loadingSection = true;
|
||||
|
||||
const auto filepath = epub->getSpineItem(currentSpineIndex).href;
|
||||
LOG_DBG("ERS", "Loading file: %s, index: %d", filepath.c_str(), currentSpineIndex);
|
||||
section = std::unique_ptr<Section>(new Section(epub, currentSpineIndex, renderer));
|
||||
@@ -880,6 +882,7 @@ void EpubReaderActivity::renderScreen() {
|
||||
viewportHeight, SETTINGS.hyphenationEnabled, SETTINGS.embeddedStyle, popupFn)) {
|
||||
LOG_ERR("ERS", "Failed to persist page data to SD");
|
||||
section.reset();
|
||||
loadingSection = false;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@@ -912,6 +915,8 @@ void EpubReaderActivity::renderScreen() {
|
||||
section->currentPage = newPage;
|
||||
pendingPercentJump = false;
|
||||
}
|
||||
|
||||
loadingSection = false;
|
||||
}
|
||||
|
||||
renderer.clearScreen();
|
||||
|
||||
Reference in New Issue
Block a user