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:
@@ -17,14 +17,14 @@ void HalPowerManager::setPowerSaving(bool enabled) {
|
||||
if (enabled && !isLowPower) {
|
||||
LOG_DBG("PWR", "Going to low-power mode");
|
||||
if (!setCpuFrequencyMhz(LOW_POWER_FREQ)) {
|
||||
LOG_ERR("PWR", "Failed to set low-power CPU frequency");
|
||||
LOG_DBG("PWR", "Failed to set CPU frequency = %d MHz", LOW_POWER_FREQ);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!enabled && isLowPower) {
|
||||
LOG_DBG("PWR", "Restoring normal CPU frequency");
|
||||
if (!setCpuFrequencyMhz(normalFreq)) {
|
||||
LOG_ERR("PWR", "Failed to restore normal CPU frequency");
|
||||
LOG_DBG("PWR", "Failed to set CPU frequency = %d MHz", normalFreq);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user