Commit Graph
411 Commits
Author SHA1 Message Date
jpirnay 1af3f81336 PR 1507 2026-03-26 11:05:13 +01:00
jpirnay f8374bb66b Merge branch 'chore-portugues' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-26 11:02:03 +01:00
jpirnay 86c935bfc9 Fix codes 2026-03-26 10:43:37 +01:00
jpirnay 64b8c71799 Fix non-unique ids 2026-03-26 09:22:21 +01:00
jpirnay 483da0af66 Merge branch 'chore-portugues' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-25 22:20:58 +01:00
jpirnay deb0199c86 Fix wrong language code for ptbr and introduced ptPt 2026-03-25 22:14:38 +01:00
jpirnay 5745e598e3 fix: migrate KOSync registerUser to esp_http_client 2026-03-25 20:22:01 +01:00
trilwu 08739746f8 style: fix clang-format alignment and log allocation failure
Address CI clang-format check and CodeRabbit review feedback:
- Fix parameter alignment (one extra space)
- Log warning when response buffer allocation fails

(cherry picked from commit 3900ea1feb017c07bd5e38da0b471fe623ec506e)
2026-03-25 20:19:46 +01:00
trilwu 10ea651e26 fix: use esp_http_client for KOSync to prevent TLS OOM on ESP32-C3
The Arduino WiFiClientSecure allocates 16KB TLS buffers by default,
which exhausts the ESP32-C3's limited heap (~46KB free after WiFi)
during the TLS handshake. This causes KOReader sync to fail silently
or crash on HTTPS servers (including the default sync.koreader.rocks).

Replace WiFiClientSecure/HTTPClient with esp_http_client (ESP-IDF),
which supports configurable buffer sizes. Use 2KB TLS buffers — more
than sufficient for KOSync's tiny JSON payloads (<1KB).

Also:
- Use esp_crt_bundle for proper TLS certificate verification instead
  of setInsecure()
- Strip trailing slashes from server URL to prevent double-slash in
  API paths
- Add lastHttpCode for diagnostics
- Add heap logging to help debug memory issues

Fixes #581

(cherry picked from commit 835abc19ff14fcbea8571ccb0dfd8d21e882b84c)
2026-03-25 20:19:46 +01:00
jpirnay a5fa684d2b Merge branch 'perf-lut-cache' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-25 18:09:53 +01:00
jpirnay 36b471891d Merge branch 'fix-xtc-2gb' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-25 18:08:34 +01:00
jpirnay afe0b82228 Cover remaining seeks 2026-03-25 17:53:18 +01:00
jpirnay 7d43c876a4 Remove 2GB limit for XTC files 2026-03-25 17:35:19 +01:00
jpirnayandClaude Opus 4.6 7496bf95ce Merge branch 'master' of origin into perf-lut-cache
Resolved conflicts in Section.h and Section.cpp:
- Combined includes (vector for LUT cache + optional/string from master)
- Added imageRendering parameter to loadSectionFile declaration
- Kept non-const clearCache (needs to close file handle for LUT cache)
- Kept in-memory LUT cache in loadPageFromSectionFile (replaces master's
  per-page LUT seek)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-25 17:17:51 +01:00
jpirnay f80e2ecea3 Merge branch 'master' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-25 10:40:08 +01:00
Baris AlbayrakandBarış Albayrak 1b00fe5a9a chore: Turkish localization for STR_SHOW_HIDDEN_FILES (#1487)
Adds the missing Turkish translation for STR_SHOW_HIDDEN_FILES in
lib/I18n/translations/turkish.yaml.

- Added: STR_SHOW_HIDDEN_FILES: "Gizli Dosyaları Göster"
- Scope: Turkish only (single-key micro-fix)

This follows up the missing-translations callout in #1483.

Co-authored-by: Barış Albayrak <barisa@pop-os.lan>
2026-03-25 08:29:03 +02:00
Dani Poveda 4ca447edcb chore: Spanish localization for STR_SHOW_HIDDEN_FILES (#1486)
## Summary

* Adding Spanish translation for string `STR_SHOW_HIDDEN_FILES`

---

### 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**_
2026-03-25 08:25:55 +02:00
jpirnay cc46225f22 Merge branch 'feat-remove-from-recents' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-23 21:43:06 +01:00
jpirnay dc6074225c Use proper term 2026-03-23 21:30:22 +01:00
jpirnay eadcead501 fix: Fix img layout issue / support CSS display:none for elements and images (#1443)
## Summary
- Add CSS `display: none` support to the EPUB rendering pipeline (fixes
#1431)
- Parse `display` property in stylesheets and inline styles, with full
cascade resolution (element, class, element.class, inline)
- Skip hidden elements and all their descendants in
`ChapterHtmlSlimParser`
- Separate display:none check for `<img>` tags (image code path is
independent of the general element handler)
- Flush pending text blocks before placing images to fix layout ordering
(text preceding an image now correctly renders above it)
- Bump CSS cache version to 4 to invalidate stale caches
- Add test EPUB (`test_display_none.epub`) covering class selectors,
element selectors, combined selectors, inline styles, nested hidden
content, hidden images, style priority/override, and realistic use cases
2026-03-23 13:51:02 -05:00
jpirnay e0ee59cbdf Merge branch 'feat-kosync-onlongpress' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-23 12:42:23 +01:00
jpirnay 75350b0a3e Incorporate koreader registration 2026-03-23 12:35:01 +01:00
jpirnay 9d5d468d86 Merge branch 'feat-indexing-feedback' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-23 12:03:00 +01:00
jpirnay 2d1f635f10 Provide visual progress feedback during indexing 2026-03-23 11:29:33 +01:00
jpirnay 485ff7e9f3 Language update 2026-03-22 14:13:11 +01:00
jpirnay 4b71ae3a8c Merge branch 'master' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-22 13:18:02 +01:00
jpirnayandClaude Opus 4.6 b625b8bd26 Add paragraph index LUT for accurate KOReader position sync
Store per-page paragraph indices in section cache to enable precise
XPath-to-page and page-to-XPath mapping without reparsing XHTML.

Forward path (upload): generates XPath directly from paragraph LUT
instead of byte-offset estimation, eliminating drift in chapters
with non-uniform content density.

Reverse path (download): resolves incoming KOReader XPath p[N] to
the exact page via paragraph LUT lookup.

Paragraph counter counts all <p> elements including display:none
to match ChapterXPathIndexer and crengine's standard XPath counting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 12:29:26 +01:00
jpirnay dccb82642d Merge branch 'feat-koysnc-xpath' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-21 20:10:23 +01:00
jpirnay 5b710e960f Fix OOM 2026-03-21 20:04:03 +01:00
Xuan-Son NguyenandZach Nelson e1b74c9db5 fix: use sleep routine from the original firmware (#1298)
## Summary

Fixes #1263

I spent half of my day(-off) reverse engineering the stock english
firmware V3.1.1, it's more or less like solving a sudoku with some known
pieces (like debug strings, known static addresses, known compiled
function, etc) and then the task is to guess the rest.

Long story short, this is the sleep routine that they use:

<img width="674" height="604" alt="image"
src="https://github.com/user-attachments/assets/6d53ce44-7bae-40c7-b4fb-24f898dbcc05"
/>

From the code above:
- They pull down GPIO13 (value = 0xd) before sleep
- They verify that power button is released by doing a delay loop of
50ms, similar to what we're doing
- `esp_sleep_config_gpio_isolate` is called but I'm not 100% sure why
- Pull up power button, note that it's likely redundant because power
button should already pulled up by `InputManager`
- `param1` and `param2` means enabling front/side buttons for wake up,
but it doesn't used in the code in reality. But I think it's physically
impossible, see the explanation below
- `param3` means "wake up from power button"
- `esp_sleep_start` is used; there is a logic to handle if it fails to
sleep, then retry recursively (no idea why!)

My observation is that they use GPIO13 so that it will be on HIGH state
when the chip is powered on, without any user space code to keep it on
that state. And once going to deep sleep, it goes into FLOATING by
default. That may explain why it need to be in LOW state before going to
sleep. (Nice trick btw)

Looking again at the circuit diagram provided
[here](https://github.com/sunwoods/Xteink-X4/blob/main/readme-img/sch.jpg)
(note: it's not official):

<img width="705" height="384" alt="image"
src="https://github.com/user-attachments/assets/b98d59fd-47ca-4d3d-a24a-94bf999e957b"
/>

It kinda make sense as the GPIO13 and VBUS (USB VCC) have the same role,
they are part of a simple "battery protection" cirtuit

Now, we may wonder, how the device wake up when there is no battery at
all?

<img width="440" height="323" alt="image"
src="https://github.com/user-attachments/assets/2981c411-239b-49a7-b9f7-9a75b6c1b6d3"
/>

It seems like power button is not just a simple switch between GPIO3 and
ground, but it also linked the POWER_CTRL, which leads to nowhere on the
diagram, but I suppose it connects the battery back for a short amount
of time, just enough for the MCU to wake up, and GPIO13 goes HIGH again.
It may also explain why power button becomes non-responsive for ~1
second after power on, as it's being pulled up by the current from
battery (remind: high = not pressed, low = pressed)

To test the theory above, I simply **comment out** the
`esp_deep_sleep_enable_gpio_wakeup`:
- On battery, power button works as nothing happen
- On USB, it doesn't wake up, I need to press RST

---

Important things about my analysis:
1. I had to name every function on the code above **manually**, but I'm
99% confident about it. The only function that I'm not sure is
`esp_wifi_bt_power_domain_off` ; Edit: it was indeed mislabeled, see
https://github.com/crosspoint-reader/crosspoint-reader/pull/1298#discussion_r2879670852
2. Some logic inside the stock firmware looks very strange, there is
almost no mention to "arduino" in the hardware, suggesting that they may
just call esp-idf functions directly, bypassing the arduino abstraction.

---

### 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**

---------

Co-authored-by: Zach Nelson <zach@zdnelson.com>
2026-03-21 13:35:38 -05:00
Adrian Wilkins-Caruana 1a1770b06b fix: Fix prewarm perf when a page contains many styles (#1451)
## Summary

**What is the goal of this PR?** (e.g., Implements the new feature for
file uploading.)

Fix prewarm perf when a page contains many styles.

The prewarm page buffer was a single slot, so each `prewarmCache` call
for a new font style freed the previous style's glyphs. On pages with
multiple styles (regular + bold + italic), only the last style was
prewarmed. The others fell through to the hot-group compaction path at
~2-3ms per glyph.

This was most visible on rich formatting (e.g. this [Czech prayer
book](https://stahuj.kancional.cz/e-kniha/kancional.epub) with bold
headings, italic liturgical text, and regular body), where page renders
took 3-5 seconds instead of ~700ms.

Fix: use up to 4 page buffer slots (one per font style) so all styles
stay prewarmed simultaneously.

Fixes #1450.

---

### 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? PARTIALLY: to diagnose and
brainstorm solutions.
2026-03-21 12:10:41 -05:00
jpirnay b08b576ddf Merge branch 'feat-koysnc-xpath' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-21 09:04:41 +01:00
jpirnay beeea38721 Remove cache - caused OOM in certain scenarios 2026-03-21 09:04:03 +01:00
jpirnay 484b998366 Merge branch 'fix-displaynone' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-20 18:37:04 +01:00
jpirnay fa836f3c60 Review fixes 2026-03-20 18:26:18 +01:00
jpirnay 06839c11a8 Merge branch 'fix-displaynone' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-20 17:57:43 +01:00
jpirnay f8a5400a04 Fix crash 2026-03-20 17:24:57 +01:00
jpirnay a068f76074 Fix img layout bug 2026-03-20 17:15:08 +01:00
jpirnay 9c8e64402d Recognize css display:none, fixes #1431 2026-03-20 14:48:41 +01:00
jpirnay b206a3fa8b Merge branch 'feat-sdcard-info' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-20 13:03:18 +01:00
jpirnay b354aabc44 Enrich System information 2026-03-20 13:00:38 +01:00
jpirnay b7cb9517ea Fix xpath case issue 2026-03-20 11:13:36 +01:00
jpirnay 14d1c14137 Fix xpath case issue 2026-03-20 11:12:19 +01:00
jpirnay b545912734 Merge branch 'feat-koysnc-xpath' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-20 09:44:21 +01:00
jpirnay 5dec3d7f95 Reuse spine 2026-03-20 09:43:26 +01:00
jpirnay 442b666826 feat: battery charging indicator (mirroring PR #537) (#1427)
## Summary

* **What is the goal of this PR?** All praise goes to @didacta for his
PR #537. Just picked up the reviewer comments to contain the changes as
suggested (there was no response for more than 6 weeks, so I wanted to
reanimate this feature).

Just one addition: should recognize usb cable plug ins / retractions and
update the icon immediately

* **What changes are included?**

## Additional Context

see #537 

---

### 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 >**_
2026-03-19 22:33:29 -05:00
jpirnay cfab6705ab Fix2 2026-03-19 17:54:19 +01:00
jpirnay 720ff24271 fix 1 2026-03-19 17:48:41 +01:00
jpirnay 33de67d23c Merge branch 'fix-ghosting' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-19 17:45:40 +01:00
jpirnay 913c24407b case fix 2026-03-19 16:43:34 +01:00