This commit addresses two issues:
1. **Issue #342 - Device freeze on exit**: The device would freeze when
pressing back button during Calibre wireless connection because tasks
were being forcibly deleted while holding mutexes or blocked on network
I/O. Fixed by:
- Adding atomic `shouldStop` flag for cooperative shutdown
- Closing network connections before deleting tasks (unblocks I/O)
- Tasks now check shouldStop and self-delete gracefully
- Using eTaskGetState() to avoid double-deletion
- Proper delay sequences between cleanup steps (like WebServerActivity)
- Breaking discovery wait into smaller chunks for faster exit response
2. **Free space reporting**: Removed the confusing "ignore free space"
message that required users to dig into Calibre plugin settings.
Now reports 100GB free space which allows all practical transfers.
Documented the proper SDK fix needed for actual free space queries.
Additional improvements:
- Added esp_task_wdt.h include for watchdog reset capability
- Added serial logging throughout shutdown sequence for debugging
- Improved code comments explaining shutdown behavior
## Summary
Adds support for browsing and downloading books from a Calibre-web
server via OPDS.
How it works
1. Configure server URL in Settings → Calibre Web URL (e.g.,
https://myserver.com:port I use Cloudflare tunnel to make my server
accessible anywhere fwiw)
2. "Calibre Library" will now show on the the home screen
3. Browse the catalog - navigate through categories like "By Newest",
"By Author", "By Series", etc.
4. Download books - select a book and press Confirm to download the EPUB
to your device
Navigation
- Up/Down - Move through entries
- Confirm - Open folder or download book
- Back - Go to parent catalog, or exit to home if at root
- Navigation entries show with > prefix, books show title and author
- Button hints update dynamically ("Open" for folders, "Download" for
books)
Technical details
- Fetches OPDS catalog from {server_url}/opds
- Parses both navigation feeds (catalog links) and acquisition feeds
(downloadable books)
- Maintains navigation history stack for back navigation
- Handles absolute paths in OPDS links correctly (e.g.,
/books/opds/navcatalog/...)
- Downloads EPUBs directly to the SD card root
Note
The server URL should be typed to include https:// if the server
requires it - HTTP→HTTPS redirects may cause SSL errors on ESP32.
## Additional Context
* I also changed the home titles to use uppercase for each word and
added a setting to change the size of the side margins
---------
Co-authored-by: Dave Allie <dave@daveallie.com>