Brings ~55 mod-exclusive files to the upstream-based mod/master-resync branch: Activities (migrated to new ActivityManager pattern): - Clock/Time: SetTimeActivity, SetTimezoneOffsetActivity, NtpSyncActivity - Dictionary: DictionaryDefinitionActivity, DictionarySuggestionsActivity, DictionaryWordSelectActivity, LookedUpWordsActivity - Bookmark: EpubReaderBookmarkSelectionActivity - Book management: BookManageMenuActivity, EndOfBookMenuActivity - OPDS: OpdsServerListActivity, OpdsSettingsActivity - Utility: DirectoryPickerActivity, NumericStepperActivity Utilities (unchanged): - BookManager, BookSettings, BookmarkStore, BootNtpSync - Dictionary, LookupHistory, TimeSync, OpdsServerStore Libraries: PlaceholderCover, TableData, ChapterXPathIndexer Scripts: inject_mod_version, generate_book_icon, preview_placeholder_cover Docs: KOReader sync XPath mapping Migration changes: - ActivityWithSubactivity -> Activity base class - Callback constructors -> finish()/setResult() pattern - enterNewActivity() -> startActivityForResult() - Activity::RenderLock&& -> RenderLock&& These files won't compile yet - they reference mod settings and I18n strings that will be added in subsequent phases. Made-with: Cursor
2.4 KiB
Adjust Low Power Mode: Fix Processing Bug and Sync with PR #852
Date: 2026-02-15 Branch: mod/adjust-low-power-mode
Task
Fix a bug where the device enters low-power mode (10MHz CPU) during first-time book opening and chapter indexing, causing significant slowdown. Also sync minor logging differences with upstream PR #852.
Root Causes (three issues combined)
-
Missing delegation in ActivityWithSubactivity:
main.cppcallspreventAutoSleep()onReaderActivity(the top-level activity).ReaderActivitycreatesEpubReaderActivityas a subactivity, butActivityWithSubactivitynever delegatedpreventAutoSleep()orskipLoopDelay()to the active subactivity. -
Stale check across activity transitions: The
preventAutoSleep()check at the top of the main loop runs beforeloop(). When an activity transitions mid-loop (HomeActivity -> ReaderActivity), the pre-loop check is stale but the post-loop power-saving decision fires. -
Section object vs section file:
!sectionalone was insufficient as a condition. The Section object is created early in the!sectionblock, makingsectionnon-null, butcreateSectionFile()(the slow operation) runs afterward. A separateloadingSectionflag is needed to cover the full duration.
Changes Made
-
ActivityWithSubactivity (
src/activities/ActivityWithSubactivity.h)- Added
preventAutoSleep()override that delegates tosubActivity->preventAutoSleep() - Added
skipLoopDelay()override with same delegation pattern
- Added
-
main.cpp (
src/main.cpp)- Added a second
preventAutoSleep()re-check aftercurrentActivity->loop()returns, before the power-saving block
- Added a second
-
EpubReaderActivity (
src/activities/reader/EpubReaderActivity.h,.cpp)- Added
volatile bool loadingSectionflag preventAutoSleep()returns!section || loadingSection!sectioncovers the pre-Section-object period (including cover prerendering in onEnter)loadingSectioncovers the full!sectionblock inrenderScreen()wherecreateSectionFile()runs- Flag is also cleared on the error path
- Added
-
TxtReaderActivity (
src/activities/reader/TxtReaderActivity.h)preventAutoSleep()returns!initialized- Covers cover prerendering and page index building
-
HalPowerManager.cpp (
lib/hal/HalPowerManager.cpp)- Synced log messages with upstream PR:
LOG_ERR->LOG_DBGwith frequency values (matching commitff89fb1)
- Synced log messages with upstream PR: