Skip to content

fix: harden epub progress saves during sync#193

Merged
uxjulia merged 3 commits into
developmentfrom
fix/atomic-epub-progress
May 24, 2026
Merged

fix: harden epub progress saves during sync#193
uxjulia merged 3 commits into
developmentfrom
fix/atomic-epub-progress

Conversation

@uxjulia
Copy link
Copy Markdown
Owner

@uxjulia uxjulia commented May 23, 2026

Summary

  • Save EPUB progress.bin through a synced temp file and rotate the previous file to progress.bin.bak before replacing it.
  • Load EPUB progress through a shared helper that falls back to the backup file if the primary file is missing or invalid.
  • Preserve KOReader remote totalPages when applying remote progress so the saved resume data remains complete.

Why

progress.bin was previously opened with the SDK write helper, which truncates the file before writing. If the device crashes or loses power during that write, the old resume pointer is already gone. The KOReader apply-remote path also wrote pageCount=0, which made the saved sync result less useful for resume/progress display.

Validation

  • ./bin/clang-format-fix
  • pio run -e simulator -j1
  • pio run -e tiny -j1

@uxjulia uxjulia linked an issue May 23, 2026 that may be closed by this pull request
@uxjulia uxjulia force-pushed the fix/atomic-epub-progress branch from 9979aa8 to 2da51d7 Compare May 23, 2026 15:28
@uxjulia uxjulia marked this pull request as ready for review May 23, 2026 17:12
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dddd3be543

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/activities/reader/KOReaderSyncActivity.cpp Outdated
imshentastic referenced this pull request in imshentastic/CrumBLE May 23, 2026
## Summary

Adds define to omit optional fonts from the build. This reduces time to
flash from >31s to <13s. Useful for development that doesn't require
fonts. Addresses #193

Invoke it like this during development:
`PLATFORMIO_BUILD_FLAGS="-D OMIT_FONTS" pio run --target upload && pio
device monitor`

Changing the define causes `pio` to do a full rebuild (but it will be
quick if you keep the define).

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? NO
@uxjulia uxjulia merged commit 7ec38b5 into development May 24, 2026
3 checks passed
@uxjulia uxjulia deleted the fix/atomic-epub-progress branch May 24, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash when syncing reading position

1 participant