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:
@@ -440,6 +440,13 @@ void loop() {
|
||||
}
|
||||
}
|
||||
|
||||
// Re-check preventAutoSleep: the activity may have changed during loop() above
|
||||
// (e.g., HomeActivity transitioned to EpubReaderActivity with pending section work).
|
||||
if (currentActivity && currentActivity->preventAutoSleep()) {
|
||||
lastActivityTime = millis();
|
||||
powerManager.setPowerSaving(false);
|
||||
}
|
||||
|
||||
// Add delay at the end of the loop to prevent tight spinning
|
||||
// When an activity requests skip loop delay (e.g., webserver running), use yield() for faster response
|
||||
// Otherwise, use longer delay to save power
|
||||
|
||||
Reference in New Issue
Block a user