Files
crosspoint-reader-mod/chat-summaries/2026-02-15_20-30-summary.md
cottongin dfbc931c14 mod: Phase 1 - bring forward mod-exclusive files with ActivityManager migration
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
2026-03-07 15:10:00 -05:00

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)

  1. Missing delegation in ActivityWithSubactivity: main.cpp calls preventAutoSleep() on ReaderActivity (the top-level activity). ReaderActivity creates EpubReaderActivity as a subactivity, but ActivityWithSubactivity never delegated preventAutoSleep() or skipLoopDelay() to the active subactivity.

  2. Stale check across activity transitions: The preventAutoSleep() check at the top of the main loop runs before loop(). When an activity transitions mid-loop (HomeActivity -> ReaderActivity), the pre-loop check is stale but the post-loop power-saving decision fires.

  3. Section object vs section file: !section alone was insufficient as a condition. The Section object is created early in the !section block, making section non-null, but createSectionFile() (the slow operation) runs afterward. A separate loadingSection flag is needed to cover the full duration.

Changes Made

  1. ActivityWithSubactivity (src/activities/ActivityWithSubactivity.h)

    • Added preventAutoSleep() override that delegates to subActivity->preventAutoSleep()
    • Added skipLoopDelay() override with same delegation pattern
  2. main.cpp (src/main.cpp)

    • Added a second preventAutoSleep() re-check after currentActivity->loop() returns, before the power-saving block
  3. EpubReaderActivity (src/activities/reader/EpubReaderActivity.h, .cpp)

    • Added volatile bool loadingSection flag
    • preventAutoSleep() returns !section || loadingSection
    • !section covers the pre-Section-object period (including cover prerendering in onEnter)
    • loadingSection covers the full !section block in renderScreen() where createSectionFile() runs
    • Flag is also cleared on the error path
  4. TxtReaderActivity (src/activities/reader/TxtReaderActivity.h)

    • preventAutoSleep() returns !initialized
    • Covers cover prerendering and page index building
  5. HalPowerManager.cpp (lib/hal/HalPowerManager.cpp)

    • Synced log messages with upstream PR: LOG_ERR -> LOG_DBG with frequency values (matching commit ff89fb1)