Skip to content

fix: use sleep routine from the original firmware#1298

Merged
znelson merged 4 commits into
crosspoint-reader:masterfrom
ngxson:xsn/stock_sleep
Mar 21, 2026
Merged

fix: use sleep routine from the original firmware#1298
znelson merged 4 commits into
crosspoint-reader:masterfrom
ngxson:xsn/stock_sleep

Conversation

@ngxson
Copy link
Copy Markdown
Contributor

@ngxson ngxson commented Mar 3, 2026

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:

image

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 (note: it's not official):

image

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?

image

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 fix: use sleep routine from the original firmware #1298 (comment)
  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

@ngxson
Copy link
Copy Markdown
Contributor Author

ngxson commented Mar 3, 2026

@jpirnay I cannot confirm if the stock firmware hold the CS pin to low or not, but I think it's quite unlikely. However, I appreciate if you can verify my theory here when you get the board. I ordered one but it won't arrive in 1-2 weeks.

Copy link
Copy Markdown
Member

@znelson znelson left a comment

Choose a reason for hiding this comment

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

@ngxson what would be fixed by this change? #1263?

Comment thread lib/hal/HalPowerManager.cpp Outdated
@ngxson
Copy link
Copy Markdown
Contributor Author

ngxson commented Mar 3, 2026

what would be fixed by this change? #1263?

Yes, quite likely. However, I would appreciate if someone with better electronic knowledge to confirm my finding about the battery protection circuit.

Co-authored-by: Zach Nelson <zach@zdnelson.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 3, 2026

📝 Walkthrough

Walkthrough

Adds pre-deep-sleep GPIO sequencing in HalPowerManager::startDeepSleep(): drives GPIO_SPIWP (GPIO13) low, isolates GPIOs, enables deep-sleep GPIO hold for SPIWP, reconfigures the power button pin, arms GPIO wakeup, then enters deep sleep.

Changes

Cohort / File(s) Summary
GPIO Pre-Sleep Configuration
lib/hal/HalPowerManager.cpp
In startDeepSleep(): set GPIO_SPIWP (GPIO13) as output low, call esp_sleep_config_gpio_isolate(), enable deep-sleep GPIO hold and gpio_hold_en() for SPIWP, move/add pinMode(InputManager::POWER_BUTTON_PIN, INPUT_PULLUP), configure GPIO wakeup, then call esp_deep_sleep_start().

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: implementing the sleep routine from the original stock firmware into HalPowerManager.
Description check ✅ Passed The PR description provides extensive technical context about reverse-engineered firmware behavior, GPIO sequencing, and hardware circuit analysis directly related to the changes in HalPowerManager.cpp.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@iandchasse
Copy link
Copy Markdown
Contributor

EE here, sound analysis I think. Bit of a weird design on their part, I think the effort done to to design a latch/un-latching mechanism for the ESP is probably more effort than what's needed to just ensure low current draw in deep sleep WITHOUT completely severing power.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@lib/hal/HalPowerManager.cpp`:
- Around line 65-67: The call to gpio_hold_en(GPIO_SPIWP) in HalPowerManager.cpp
won’t preserve GPIO13 through deep sleep; after gpio_hold_en(GPIO_SPIWP) add a
call to gpio_deep_sleep_hold_en(GPIO_SPIWP) so the pin is latched during deep
sleep (keep esp_sleep_config_gpio_isolate() and the POWER_BUTTON_PIN pinMode
call as-is); ensure you call the deep-sleep hold API on the same symbol
GPIO_SPIWP so the SPIWP line stays held low across deep sleep.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8859407 and 21f6daf.

📒 Files selected for processing (1)
  • lib/hal/HalPowerManager.cpp
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: cppcheck
  • GitHub Check: build
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2026-02-27T22:49:59.600Z
Learnt from: ngxson
Repo: crosspoint-reader/crosspoint-reader PR: 1218
File: src/activities/ActivityManager.cpp:254-265
Timestamp: 2026-02-27T22:49:59.600Z
Learning: In this codebase, assertions are always enabled (no NDEBUG). Use assert() to crash on programmer errors and surface logic bugs during development and in production builds. Do not rely on asserts for runtime error handling; they should enforce invariants that must always hold. Keep asserts side-effect free and inexpensive, and avoid relying on them for user-visible failures. Include <cassert> where appropriate and document the invariant being tested.

Applied to files:

  • lib/hal/HalPowerManager.cpp
📚 Learning: 2026-03-02T10:14:16.036Z
Learnt from: Uri-Tauber
Repo: crosspoint-reader/crosspoint-reader PR: 1245
File: lib/Epub/Epub/Section.cpp:277-308
Timestamp: 2026-03-02T10:14:16.036Z
Learning: Guideline: Strengthen serialization::readString to defend against unbounded growth when reading from disk data. Implement and enforce a maximum allowed length (e.g., a configured or reasonable constant) and validate the incoming length before resizing or allocating. Audit all call sites (e.g., BookMetadataCache, TextBlock, KOReaderCredentialStore, Section cache readers) to ensure they do not rely on unbounded len-based resizing. If the readString API must remain, add internal safeguards (bounds checks, length validation, and error handling) so per-call-site validations are not required. Ensure Section cache files remain versioned (SECTION_FILE_VERSION) and parameter mismatches invalidate caches, but do not rely on unsafe allocations; prefer safe, bounded reads with explicit errors on invalid data.

Applied to files:

  • lib/hal/HalPowerManager.cpp
🔇 Additional comments (1)
lib/hal/HalPowerManager.cpp (1)

56-59: Nice parity with stock pre-sleep GPIO behavior.

Setting GPIO13 explicitly to output low before sleep is a solid, hardware-aware change and also addresses the earlier direction ambiguity.

Comment on lines +65 to +67
esp_sleep_config_gpio_isolate();
gpio_hold_en(GPIO_SPIWP);
pinMode(InputManager::POWER_BUTTON_PIN, INPUT_PULLUP);
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot Mar 3, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, explore the file structure
find . -name "HalPowerManager.cpp" -type f

Repository: crosspoint-reader/crosspoint-reader

Length of output: 108


🏁 Script executed:

# Search for GPIO_SPIWP definition to understand what pin it maps to
rg "GPIO_SPIWP" --type cpp --type h -B 2 -A 2

Repository: crosspoint-reader/crosspoint-reader

Length of output: 1002


🏁 Script executed:

# Check if gpio_deep_sleep_hold_en is used anywhere in the codebase
rg "gpio_deep_sleep_hold_en" --type cpp --type h

Repository: crosspoint-reader/crosspoint-reader

Length of output: 61


🏁 Script executed:

# Look at the actual file content around the lines in question
head -100 lib/hal/HalPowerManager.cpp | tail -50

Repository: crosspoint-reader/crosspoint-reader

Length of output: 1716


🌐 Web query:

ESP-IDF GPIO deep sleep hold documentation ESP32 gpio_hold_en vs gpio_deep_sleep_hold_en

💡 Result:

  • gpio_hold_en(gpio_num): Enables per-pin pad hold. When enabled, the pin’s current configuration (input/output enable, output level, function select, drive strength, etc.) is latched and won’t change even if the GPIO matrix/IOMUX/config is later modified. It’s useful across events like reset, Deep-sleep trigger, or peripheral power-down in Light-sleep—but note a key SoC caveat: on ESP32-S2/C3/S3/C2, gpio_hold_en() alone does not keep a digital GPIO held through Deep-sleep (the digital GPIO resets to default on wake); Espressif explicitly says to use gpio_deep_sleep_hold_en() for that case. [1]

  • gpio_deep_sleep_hold_en(): Enables the “digital GPIO hold during Deep-sleep” feature globally (affects all digital GPIO pads during Deep-sleep only). The held state is each pad’s active configuration (not the “sleep configuration”). Two important notes from the docs:

    1. It only takes effect for pins that already have per-pin hold enabled via gpio_hold_en();
    2. Outside Deep-sleep (active mode), GPIOs can still be changed normally (except pins currently locked by gpio_hold_en()). [1]
  • Typical usage for “keep a digital GPIO level during Deep-sleep” (ESP32-S2/C3/S3/C2, etc.):

    1. configure pin as output + set level
    2. gpio_hold_en(pin)
    3. gpio_deep_sleep_hold_en() (once enabled, it applies to subsequent Deep-sleep cycles until disabled)
    4. enter deep sleep
      Disable with gpio_deep_sleep_hold_dis() and/or gpio_hold_dis(pin) when you want to change the pin again. [1]
  • RTC IO hold is separate (EXT0/EXT1 wake pins, etc.): ESP-IDF may automatically put wakeup RTC IOs into a holding state before sleep (especially if RTC peripherals are powered down), and for Light-sleep wake, you may need to call rtc_gpio_hold_dis() after waking to reconfigure pins (Deep-sleep wake is handled at startup). [2]

Sources: ESP-IDF GPIO API reference (pad hold + deep-sleep hold notes) [1]; ESP-IDF Sleep Modes docs (hold behavior around sleep/wakeup, rtc_gpio_hold_dis) [2].


gpio_hold_en() alone is insufficient to hold GPIO13 through deep sleep—add gpio_deep_sleep_hold_en().

On ESP32-family SoCs (especially S2/C3/S3/C2), gpio_hold_en() does not retain a digital GPIO state during deep sleep by itself. The ESP-IDF documentation explicitly requires gpio_deep_sleep_hold_en() to hold GPIO pins during deep sleep. Without it, GPIO13 (SPIWP) will not remain latched low, risking unwanted SPI operations during sleep.

Proposed fix
   esp_sleep_config_gpio_isolate();
   gpio_hold_en(GPIO_SPIWP);
+  gpio_deep_sleep_hold_en();
   pinMode(InputManager::POWER_BUTTON_PIN, INPUT_PULLUP);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
esp_sleep_config_gpio_isolate();
gpio_hold_en(GPIO_SPIWP);
pinMode(InputManager::POWER_BUTTON_PIN, INPUT_PULLUP);
esp_sleep_config_gpio_isolate();
gpio_hold_en(GPIO_SPIWP);
gpio_deep_sleep_hold_en();
pinMode(InputManager::POWER_BUTTON_PIN, INPUT_PULLUP);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/hal/HalPowerManager.cpp` around lines 65 - 67, The call to
gpio_hold_en(GPIO_SPIWP) in HalPowerManager.cpp won’t preserve GPIO13 through
deep sleep; after gpio_hold_en(GPIO_SPIWP) add a call to
gpio_deep_sleep_hold_en(GPIO_SPIWP) so the pin is latched during deep sleep
(keep esp_sleep_config_gpio_isolate() and the POWER_BUTTON_PIN pinMode call
as-is); ensure you call the deep-sleep hold API on the same symbol GPIO_SPIWP so
the SPIWP line stays held low across deep sleep.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

hmm, nice find. indeed, the esp_wifi_bt_power_domain_off in my analysis was mislabeled, that was gpio_deep_sleep_hold_en which is compiled into _DAT_6000808c = _DAT_6000808c & 0xffffbfff | 0x800;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ngxson Thank you for confirming! That's excellent detective work on the reverse engineering—the register manipulation _DAT_6000808c = _DAT_6000808c & 0xffffbfff | 0x800; definitely looks like the gpio_deep_sleep_hold_en() call setting the deep sleep hold bit.

So to match the stock firmware's behavior, you'll want to add gpio_deep_sleep_hold_en(); after the gpio_hold_en(GPIO_SPIWP); call to ensure GPIO13 stays latched low throughout deep sleep. This should help ensure the battery-protection circuit behaves correctly during sleep.


🧠 Learnings used
Learnt from: ngxson
Repo: crosspoint-reader/crosspoint-reader PR: 1218
File: src/activities/ActivityManager.cpp:254-265
Timestamp: 2026-02-27T22:49:59.600Z
Learning: In this codebase, assertions are always enabled (no NDEBUG). Use assert() to crash on programmer errors and surface logic bugs during development and in production builds. Do not rely on asserts for runtime error handling; they should enforce invariants that must always hold. Keep asserts side-effect free and inexpensive, and avoid relying on them for user-visible failures. Include <cassert> where appropriate and document the invariant being tested.

Learnt from: Uri-Tauber
Repo: crosspoint-reader/crosspoint-reader PR: 1245
File: lib/Epub/Epub/Section.cpp:277-308
Timestamp: 2026-03-02T10:14:16.036Z
Learning: Guideline: Strengthen serialization::readString to defend against unbounded growth when reading from disk data. Implement and enforce a maximum allowed length (e.g., a configured or reasonable constant) and validate the incoming length before resizing or allocating. Audit all call sites (e.g., BookMetadataCache, TextBlock, KOReaderCredentialStore, Section cache readers) to ensure they do not rely on unbounded len-based resizing. If the readString API must remain, add internal safeguards (bounds checks, length validation, and error handling) so per-call-site validations are not required. Ensure Section cache files remain versioned (SECTION_FILE_VERSION) and parameter mismatches invalidate caches, but do not rely on unsafe allocations; prefer safe, bounded reads with explicit errors on invalid data.

Comment thread lib/hal/HalPowerManager.cpp Outdated
// Pre-sleep routines from the original firmware
constexpr gpio_num_t GPIO_SPIWP = GPIO_NUM_13;
gpio_set_direction(GPIO_SPIWP, GPIO_MODE_OUTPUT);
gpio_set_level(GPIO_SPIWP, 0);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

interestingly, switching this to gpio_set_level(GPIO_SPIWP, 1) and now RTC memory is preserved across sleep, cc @osteotek

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe this has been found before, RTC is preserved but idle sleep current from the battery is 3-4mA, so it's not feasible to keep it enabled. TRMNL firmware for the X4 does this (I think?), but the battery only lasts for a few days

Copy link
Copy Markdown
Contributor Author

@ngxson ngxson Mar 3, 2026

Choose a reason for hiding this comment

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

yeah it will definitely use more battery, the current leakage to other components can be significant. just saying that now we know why/how

I'm not entire sure how TRMNL keep the device "awake", but in my experience, a light sleep also does the trick. although, it consume significantly more power than deep sleep

edit: they don't use deep sleep at all: usetrmnl/trmnl-firmware#313

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

hmm ok, so they use the same trick: https://github.com/usetrmnl/trmnl-firmware/blob/98e96ac3d341dd5535518570b6c499998c442b2a/src/bl.cpp#L1912-L1915

the difference is that the pin value is not explicitly set, so it will hold the previous value, which is high (meaning battery always connected)

that further comfirms my finding here though, gpio 13 high = battery kept connected, low = disconnect battery

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@lib/hal/HalPowerManager.cpp`:
- Around line 65-70: The calls to gpio_set_direction, gpio_set_level, and
gpio_hold_en in HalPowerManager.cpp should check their esp_err_t return values
instead of ignoring them: capture each call's return (e.g., err =
gpio_set_direction(...)), compare against ESP_OK, and handle failures by logging
a descriptive message (including the function name and relevant symbol like
GPIO_SPIWP or InputManager::POWER_BUTTON_PIN) and returning or propagating an
error as appropriate for the enclosing function; do not add checks for
esp_sleep_config_gpio_isolate or gpio_deep_sleep_hold_en since those are
void-returning. Ensure the handling is consistent (log + early return or error
code) for all three checked calls.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4cb0e8f and 9063d27.

📒 Files selected for processing (1)
  • lib/hal/HalPowerManager.cpp
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: cppcheck
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2026-02-27T22:49:59.600Z
Learnt from: ngxson
Repo: crosspoint-reader/crosspoint-reader PR: 1218
File: src/activities/ActivityManager.cpp:254-265
Timestamp: 2026-02-27T22:49:59.600Z
Learning: In this codebase, assertions are always enabled (no NDEBUG). Use assert() to crash on programmer errors and surface logic bugs during development and in production builds. Do not rely on asserts for runtime error handling; they should enforce invariants that must always hold. Keep asserts side-effect free and inexpensive, and avoid relying on them for user-visible failures. Include <cassert> where appropriate and document the invariant being tested.

Applied to files:

  • lib/hal/HalPowerManager.cpp
📚 Learning: 2026-03-02T10:14:16.036Z
Learnt from: Uri-Tauber
Repo: crosspoint-reader/crosspoint-reader PR: 1245
File: lib/Epub/Epub/Section.cpp:277-308
Timestamp: 2026-03-02T10:14:16.036Z
Learning: Guideline: Strengthen serialization::readString to defend against unbounded growth when reading from disk data. Implement and enforce a maximum allowed length (e.g., a configured or reasonable constant) and validate the incoming length before resizing or allocating. Audit all call sites (e.g., BookMetadataCache, TextBlock, KOReaderCredentialStore, Section cache readers) to ensure they do not rely on unbounded len-based resizing. If the readString API must remain, add internal safeguards (bounds checks, length validation, and error handling) so per-call-site validations are not required. Ensure Section cache files remain versioned (SECTION_FILE_VERSION) and parameter mismatches invalidate caches, but do not rely on unsafe allocations; prefer safe, bounded reads with explicit errors on invalid data.

Applied to files:

  • lib/hal/HalPowerManager.cpp
🔇 Additional comments (1)
lib/hal/HalPowerManager.cpp (1)

61-64: Good stock-parity sequencing and documentation here.

The pre-sleep GPIO13 flow and the battery-vs-USB wake notes are clear and match the stated firmware reverse-engineering goal.

Also applies to: 72-74

Comment on lines +65 to +70
gpio_set_direction(GPIO_SPIWP, GPIO_MODE_OUTPUT);
gpio_set_level(GPIO_SPIWP, 0);
esp_sleep_config_gpio_isolate();
gpio_deep_sleep_hold_en();
gpio_hold_en(GPIO_SPIWP);
pinMode(InputManager::POWER_BUTTON_PIN, INPUT_PULLUP);
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot Mar 3, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n lib/hal/HalPowerManager.cpp | sed -n '60,75p'

Repository: crosspoint-reader/crosspoint-reader

Length of output: 1127


🌐 Web query:

ESP-IDF function signatures: gpio_set_direction gpio_set_level esp_sleep_config_gpio_isolate gpio_deep_sleep_hold_en gpio_hold_en return type esp_err_t

💡 Result:

  • esp_err_t gpio_set_direction(gpio_num_t gpio_num, gpio_mode_t mode); (returns ESP_OK or ESP_ERR_INVALID_ARG) [1]
  • esp_err_t gpio_set_level(gpio_num_t gpio_num, uint32_t level); (returns ESP_OK or ESP_ERR_INVALID_ARG) [2]
  • void esp_sleep_config_gpio_isolate(void); [3]
  • void gpio_deep_sleep_hold_en(void); [4]
  • esp_err_t gpio_hold_en(gpio_num_t gpio_num); (returns ESP_OK or ESP_ERR_NOT_SUPPORTED) [4]

Sources: [1][2][4] GPIO & RTC GPIO API (ESP-IDF Programming Guide), [3] Sleep Modes API (ESP-IDF Programming Guide).


🏁 Script executed:

# Check if this is an Arduino-ESP32 project and verify the environment
find . -name "*.h" -o -name "*.cpp" -o -name "*.c" | head -20
# Look for Arduino or ESP-IDF headers
fd -e h | xargs grep -l "ESP-IDF\|Arduino\|ESP32" 2>/dev/null | head -10

Repository: crosspoint-reader/crosspoint-reader

Length of output: 1030


🏁 Script executed:

# Search for assert usage in the codebase to understand error handling pattern
rg "assert\(" -B 2 -A 2 --max-count 20

Repository: crosspoint-reader/crosspoint-reader

Length of output: 10891


Check ESP-IDF call results for error-returning functions only.

Lines 65–69 call five ESP-IDF functions, but only three return esp_err_t: gpio_set_direction, gpio_set_level, and gpio_hold_en. Their results are unchecked and could fail silently. The other two functions (esp_sleep_config_gpio_isolate and gpio_deep_sleep_hold_en) return void, so they cannot fail or be checked.

Proposed fix
   constexpr gpio_num_t GPIO_SPIWP = GPIO_NUM_13;
-  gpio_set_direction(GPIO_SPIWP, GPIO_MODE_OUTPUT);
-  gpio_set_level(GPIO_SPIWP, 0);
+  assert(gpio_set_direction(GPIO_SPIWP, GPIO_MODE_OUTPUT) == ESP_OK);
+  assert(gpio_set_level(GPIO_SPIWP, 0) == ESP_OK);
   esp_sleep_config_gpio_isolate();
   gpio_deep_sleep_hold_en();
-  gpio_hold_en(GPIO_SPIWP);
+  assert(gpio_hold_en(GPIO_SPIWP) == ESP_OK);
   pinMode(InputManager::POWER_BUTTON_PIN, INPUT_PULLUP);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
gpio_set_direction(GPIO_SPIWP, GPIO_MODE_OUTPUT);
gpio_set_level(GPIO_SPIWP, 0);
esp_sleep_config_gpio_isolate();
gpio_deep_sleep_hold_en();
gpio_hold_en(GPIO_SPIWP);
pinMode(InputManager::POWER_BUTTON_PIN, INPUT_PULLUP);
assert(gpio_set_direction(GPIO_SPIWP, GPIO_MODE_OUTPUT) == ESP_OK);
assert(gpio_set_level(GPIO_SPIWP, 0) == ESP_OK);
esp_sleep_config_gpio_isolate();
gpio_deep_sleep_hold_en();
assert(gpio_hold_en(GPIO_SPIWP) == ESP_OK);
pinMode(InputManager::POWER_BUTTON_PIN, INPUT_PULLUP);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/hal/HalPowerManager.cpp` around lines 65 - 70, The calls to
gpio_set_direction, gpio_set_level, and gpio_hold_en in HalPowerManager.cpp
should check their esp_err_t return values instead of ignoring them: capture
each call's return (e.g., err = gpio_set_direction(...)), compare against
ESP_OK, and handle failures by logging a descriptive message (including the
function name and relevant symbol like GPIO_SPIWP or
InputManager::POWER_BUTTON_PIN) and returning or propagating an error as
appropriate for the enclosing function; do not add checks for
esp_sleep_config_gpio_isolate or gpio_deep_sleep_hold_en since those are
void-returning. Ensure the handling is consistent (log + early return or error
code) for all three checked calls.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

should be fine here, it should never fail in practice, even official fw has no check for these

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ngxson, understood. Following the stock firmware's approach makes sense here, especially since these are straightforward GPIO operations on known hardware (GPIO13) that you've validated through reverse engineering. If the official firmware doesn't check these, and they're operating on fixed, well-characterized pins, the risk of failure is indeed negligible.


🧠 Learnings used
Learnt from: ngxson
Repo: crosspoint-reader/crosspoint-reader PR: 1218
File: src/activities/ActivityManager.cpp:254-265
Timestamp: 2026-02-27T22:49:59.600Z
Learning: In this codebase, assertions are always enabled (no NDEBUG). Use assert() to crash on programmer errors and surface logic bugs during development and in production builds. Do not rely on asserts for runtime error handling; they should enforce invariants that must always hold. Keep asserts side-effect free and inexpensive, and avoid relying on them for user-visible failures. Include <cassert> where appropriate and document the invariant being tested.

Learnt from: Uri-Tauber
Repo: crosspoint-reader/crosspoint-reader PR: 1245
File: lib/Epub/Epub/Section.cpp:277-308
Timestamp: 2026-03-02T10:14:16.036Z
Learning: Guideline: Strengthen serialization::readString to defend against unbounded growth when reading from disk data. Implement and enforce a maximum allowed length (e.g., a configured or reasonable constant) and validate the incoming length before resizing or allocating. Audit all call sites (e.g., BookMetadataCache, TextBlock, KOReaderCredentialStore, Section cache readers) to ensure they do not rely on unbounded len-based resizing. If the readString API must remain, add internal safeguards (bounds checks, length validation, and error handling) so per-call-site validations are not required. Ensure Section cache files remain versioned (SECTION_FILE_VERSION) and parameter mismatches invalidate caches, but do not rely on unsafe allocations; prefer safe, bounded reads with explicit errors on invalid data.

@ngxson ngxson requested a review from a team March 5, 2026 10:38
Copy link
Copy Markdown
Member

@znelson znelson left a comment

Choose a reason for hiding this comment

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

This seems reasonable to me, but I'm not EE so can't deeply analyze for correctness.

trilwu added a commit to trilwu/crosspet that referenced this pull request Mar 10, 2026
@znelson
Copy link
Copy Markdown
Member

znelson commented Mar 19, 2026

I've been using this change for many days and haven't had a hang on sleep; in my experience it seems to fix #1263. I think we should move forward with this change. @crosspoint-reader/firmware-maintainers

Copy link
Copy Markdown
Member

@andrewb1269 andrewb1269 left a comment

Choose a reason for hiding this comment

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

I'm good with this change, thanks @ngxson for your analysis on this! I'd like to get another maintainer to review it before merging if possible. Thanks!

@znelson
Copy link
Copy Markdown
Member

znelson commented Mar 21, 2026

Not a lot of activity from reviewers lately. I'm going to move ahead with this one and hopefully we can get some feedback from folks on the other side of #1263.

@znelson znelson merged commit 526c8a5 into crosspoint-reader:master Mar 21, 2026
9 of 11 checks passed
noel88 pushed a commit to noel88/crosspoint-reader-cjk that referenced this pull request Mar 25, 2026
…1298)

## Summary

Fixes crosspoint-reader#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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/6d53ce44-7bae-40c7-b4fb-24f898dbcc05">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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/b98d59fd-47ca-4d3d-a24a-94bf999e957b">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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/2981c411-239b-49a7-b9f7-9a75b6c1b6d3">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
crosspoint-reader#1298 (comment)
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>
noel88 pushed a commit to noel88/crosspoint-reader-cjk that referenced this pull request Mar 25, 2026
Cherry-picked 15 upstream commits (skipping Spanish/Turkish localizations):
- feat: integrated epub optimizer (crosspoint-reader#1224)
- feat: silent pre-indexing for next chapter (crosspoint-reader#979)
- feat: battery charging indicator (crosspoint-reader#1427)
- feat: show hidden directories in browser (crosspoint-reader#1288)
- feat: directories shown as "[dir]" (crosspoint-reader#1339)
- fix: CSS display:none support for elements/images (crosspoint-reader#1443)
- fix: overlapping battery % with anti-aliasing (crosspoint-reader#1452)
- fix: sleep routine from original firmware (crosspoint-reader#1298)
- fix: prewarm perf with many styles (crosspoint-reader#1451)
- fix: build with -fno-exceptions (crosspoint-reader#1412)
- fix: prevent line breaks on English contractions (crosspoint-reader#1405)
- chore: reduce flash usage by cleaning up i18n (crosspoint-reader#1401)
- chore: powershell clang-format script (crosspoint-reader#1472)
- chore: update SKILL.md for gitignored i18n (crosspoint-reader#1423)
- chore: remove unused PlatformIO include dir (crosspoint-reader#1417)

Resolved conflicts:
- CssStyle.h/CssParser.cpp: merged upstream display:none + our writingMode
- ChapterHtmlSlimParser.cpp: integrated display:none check with writingMode
- platformio.ini: kept CJK size optimization flags + added -fno-exceptions
- FilesPage.html: merged epub optimizer with WebSocket transport error handling
- EpubReaderActivity.cpp: added missing params to pre-indexing Section calls
- Added missing i18n keys (STR_COLOR_MODE, STR_BUILTIN_DISABLED)
- Bumped CSS_CACHE_VERSION to 5

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
lukestein pushed a commit to lukestein/crosspoint-reader that referenced this pull request Mar 26, 2026
…1298)

## Summary

Fixes crosspoint-reader#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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/6d53ce44-7bae-40c7-b4fb-24f898dbcc05">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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/b98d59fd-47ca-4d3d-a24a-94bf999e957b">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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/2981c411-239b-49a7-b9f7-9a75b6c1b6d3">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
crosspoint-reader#1298 (comment)
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>
GloriaKitchens added a commit to GloriaKitchens/crosspoint-reader that referenced this pull request Mar 29, 2026
* fix: jpeg resource cleanup (crosspoint-reader#1320)

## Summary

* **What is the goal of this PR?** Fix leak on decode error path in JPEG
converter
* **What changes are included?**
Unif resource cleanup

## Additional Context

---

### 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**_
Identification of the issue by AI

* fix: Prevent line breaks on common English contractions (crosspoint-reader#1405)

* feat: Show hidden directories in browser (crosspoint-reader#1288)

## Summary

* **What is the goal of this PR?** Add setting to display hidden files /
directories in filebrowser / web file browser
* **What changes are included?**

## Additional Context

-

---

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

* fix: Reduce flash usage by cleaning up I18n translations (crosspoint-reader#1401)

## Summary

* **What is the goal of this PR?** 
Removing no longer used i18n keys/string, to reduce (~28k) used flash
space.
To correct to swedish translations for `STR_FONT_SIZE` and
`STR_KOREADER_SYNC`.

* **What changes are included?**
   `lib\I18n\translations\*`

## Additional Context

* Add any other information that might be helpful for the reviewer
(e.g., performance implications, potential risks,
  specific areas to focus on).

---

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

* fix: Build with -fno-exceptions (crosspoint-reader#1412)

## Summary

**What is the goal of this PR?**

Until today, I sincerely thought we were building without exception
support. The codebase is not set up with any exception handling
infrastructure. The SKILL.md file specifies no exceptions.

I just learned that we actually were building with exceptions enabled,
with `-fexceptions` coming from
~/.platformio/packages/framework-arduinoespressif32-libs/esp32c3/pioarduino-build.py.

This change removes the `-fexceptions` flag and adds `-fno-exceptions`.
The result is **53,670 bytes in flash savings**.

---

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

* feat: battery charging indicator (mirroring PR crosspoint-reader#537) (crosspoint-reader#1427)

## Summary

* **What is the goal of this PR?** All praise goes to @didacta for his
PR crosspoint-reader#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 crosspoint-reader#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 >**_

* chore: Update SKILL.md to reflect generated i18n files are gitignored (crosspoint-reader#1423)

## Summary

**What is the goal of this PR?**

Update SKILL.md to stop instructing contributors to commit `I18nKeys.h`
and `I18nStrings.h`. All three generated i18n files have been gitignored
since ff57754 and are regenerated at build time.

---

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

* feat: Implement silent pre-indexing for the next chapter in EpubReaderActivity (crosspoint-reader#979)

## Summary

* A simple tweak to pre-index the next chapter silently during normal
reading.
* Triggers silent pre-indexing of the next chapter when the penultimate
page of a chapter is rendered to reduce visible interruptions.
* Keeps existing indexing with popup when a reader jumps directly into
an unindexed chapter.

## Additional Context

* Reader input is temporarily blocked during silent indexing to avoid
navigation/index state conflicts.
* The penultimate page is used because readers typically spend longer
there than on the final page.
* This change optimizes linear reading flow while preserving reliable
indexing for non-linear navigation.

## Possible Improvements

* Add a setting for First Page Indexing vs Penultimate Page Pre-indexing
* Display an indexing icon in the status bar instead of using a popup
that overlaps book text.

Tested on device:

https://www.dropbox.com/scl/fi/29g5kjqgsi5e4hgujv38u/Silent-Indexing.MOV?rlkey=yemi4mosmev5vicaa7gpe49qw&dl=0

---

### 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? _**YES**_

---------

Co-authored-by: Jake Kenneally <jakekenneally@gmail.com>

* chore: Removed unused PlatformIO include directory placeholder (crosspoint-reader#1417)

## Summary

**What is the goal of this PR?**

This change deletes include/README, which is a PlatformIO boilerplate
placeholder file explaining what header files are. The include/
directory isn't used by this project (headers live in lib/ and src/), so
this is just cleanup.

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

* fix: Fix prewarm perf when a page contains many styles (crosspoint-reader#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 crosspoint-reader#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.

* fix: use sleep routine from the original firmware (crosspoint-reader#1298)

## Summary

Fixes crosspoint-reader#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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/6d53ce44-7bae-40c7-b4fb-24f898dbcc05">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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/b98d59fd-47ca-4d3d-a24a-94bf999e957b">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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/2981c411-239b-49a7-b9f7-9a75b6c1b6d3">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
crosspoint-reader#1298 (comment)
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>

* feat: integrated epub optimizer (crosspoint-reader#1224)

## Problem

Many e-ink readers have limited image decoder support natively.
EPUBs with images in other formats than **baseline JPEG** frequently
cause:

- **Broken images**: pages render as blank, corrupted noise, or never
load
- **Slow rendering**: unoptimized images cause severe delays on e-ink
hardware, up to 7 seconds per page turn, with cover images taking up to
59 seconds to render
- **Broken covers**: the book thumbnail never generates

Fixing this today requires external tools before uploading.

---

## What this PR does

Adds an **optional, on-demand EPUB optimizer** to the file upload flow.
When enabled,
it converts all images to baseline JPEG directly in the browser — no
server, no internet,
no external tools needed.

**Conversion is opt-in. The standard upload flow is unchanged.**

---

## Real-world impact

The optimizer was applied in batch to **61 EPUBs**:
- 60 standard EPUBs: 198 MB → 55 MB (**−72.2%**, 143 MB saved)
- Text-dominant books: 8–46% smaller (covers and inline images
converted)
  - Image-heavy / illustrated books: 65–93% smaller
- 1 Large manga volume (594 MB): 594 MB → 72 MB (**−87.8%**, 522 MB
saved)
- EPUB structural integrity fully maintained — zero new validation
issues introduced across all 61 books

*Size and integrity analysis:
[epub-comparator](https://github.com/pablohc/epub-comparator)*

From that set, **17 books were selected** as a representative sample
covering different content
types: image-heavy novels, pure manga, light novels with broken images,
and text-dominant books.
Each was benchmarked on two devices running in parallel, one on `master`
and one
on `PR#1224` — measuring render time across ~30 pages per book on
average.

### Rendering bugs fixed

| Book | Problem (original) | After optimization |
|------|--------------------|--------------------|
| Fairy Tale — Stephen King | Cover took **59.7 s** to render | 2.1 s
(−96%) |
| Cycle of the Werewolf — Stephen King | Cover took **23.3 s** to render
| 1.7 s (−93%) |
| Tomie: Complete Deluxe Ed. — Junji Ito | Cover took **18.3 s** to
render | 2.0 s (−89%) |
| Joel Dicker — El tigre (Ed. Ilustrada) | Cover took **14.5 s** to
render | 1.4 s (−90%) |
| Jackson, Holly — Asesinato para principiantes | Cover failed
completely (blank) | 2.0 s ✓ |
| Sentenced to Be a Hero — Yen Press | Cover failed, **8 images failed
to load** | All fixed ✓ |
| Flynn, Gillian — Perdida | Cover failed completely (blank) | 1.6 s ✓ |
| Chandler, Raymond — Asesino en la lluvia | Cover failed completely
(blank) | 2.0 s ✓ |

### Page render times — image-heavy EPUBs (avg per page)

| Book | Pages | Avg original | Avg optimized | Improvement | File size
|
|------|-------|-------------|---------------|-------------|-----------|
| Fairy Tale — Stephen King | 30 | 3,028 ms | 1,066 ms | **−64.8%** |
32.4 MB → 9.1 MB (−72%) |
| Cycle of the Werewolf — Stephen King | 33 | 3,026 ms | 1,558 ms |
**−48.5%** | 35.1 MB → 2.9 MB (−92%) |
| Joel Dicker — El tigre (Ed. Ilustrada) | 16 | 1,846 ms | 1,051 ms |
**−43.1%** | 5.3 MB → 0.4 MB (−93%) |
| Tomie: Complete Deluxe Ed. — Junji Ito | 30 | 4,817 ms | 2,802 ms |
**−41.8%** | 593.8 MB → 72.2 MB (−87.8%) |
| Sentenced to Be a Hero — Yen Press | 30 | 1,719 ms | 1,388 ms |
**−19.2%** | 15.2 MB → 1.6 MB (−90%) |

### Text-heavy EPUBs — no regression

| Book | Pages | Avg original | Avg optimized | Delta |
|------|-------|-------------|---------------|-------|
| Christie — Asesinato en el Orient Express | 30 | 1,672 ms | 1,646 ms |
−1.6% |
| Flynn — Perdida | 30 | 1,327 ms | 1,291 ms | −2.7% |
| Dicker — La verdad sobre el caso Harry Quebert | 30 | 1,132 ms | 1,084
ms | −4.2% |
| Hammett — El halcón maltés | 30 | 1,009 ms | 966 ms | −4.3% |
| Chandler — Asesino en la lluvia | 30 | 989 ms | 1,007 ms | +1.8% |

*Differences within ±5% — consistent with device measurement noise.*

*Render time benchmark:
[epub-optimization-benchmark](https://github.com/pablohc/epub-optimization-benchmark)*

---
## How to use it

**Single file:**
1. Click **Upload** (top of the page) — a modal opens. Use **Choose
files** to select one EPUB from your device.
2. Check **Optimize**.
- *(Optional)* Expand **Advanced Mode** — adjust quality, rotation, or
overlap; set individual images to H-Split / V-Split / Rotate.
3. Click **Optimize & Upload**.

**Batch (2+ files):**
1. Click **Upload** (top of the page) — a modal opens. Use **Choose
files** to select multiple EPUBs from your device.
2. Check **Optimize**.
   - *(Optional)* Expand **Advanced Mode** — adjust quality.
3. Click **Upload** — all files are converted and uploaded sequentially.

Upload a batch of files, without optimization:
<img width="810" height="671" alt="image" src="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/d892ae13-0b87-4ea4-b6b8-340d56efc763">https://github.com/user-attachments/assets/d892ae13-0b87-4ea4-b6b8-340d56efc763"
/>

Batch file upload, with standard optimization:
<img width="809" height="707" alt="image" src="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/d32dbc88-1208-4555-bfcf-330ab91d2174">https://github.com/user-attachments/assets/d32dbc88-1208-4555-bfcf-330ab91d2174"
/>

Optimization Phase (1/2):
<img width="807" height="1055" alt="image" src="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/fd4cd5f9-e56e-4ca1-9777-6926b9baf2bb">https://github.com/user-attachments/assets/fd4cd5f9-e56e-4ca1-9777-6926b9baf2bb"
/>

Upload Phase (2/2):
<img width="805" height="1065" alt="image" src="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/483294f0-02f0-4569-ae11-c10b3581d747">https://github.com/user-attachments/assets/483294f0-02f0-4569-ae11-c10b3581d747"
/>

Batch upload successfully confirmed:
<img width="812" height="1043" alt="image" src="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/80c135bf-05c3-4c80-8755-2a04c68235bc">https://github.com/user-attachments/assets/80c135bf-05c3-4c80-8755-2a04c68235bc"
/>

---

## Options

**Always active when the converter is enabled:**
- Converts PNG, WebP, BMP, GIF → baseline JPEG
- Smart downscaling to 480×800 px max (preserves aspect ratio)
- True grayscale for e-ink (BT.709 luminance, always on)
- SVG cover fix + OPF/NCX compliance repairs

**Advanced Mode (opt-in) — single file:**
- JPEG quality presets: 30% / 45% / 60% / 75% / **85%** (default) / 95%
- Rotation direction for split images: CW (default) / CCW
- Min overlap when splitting: 5% (default) / 10% / 15%
- Auto-download conversion log toggle (detailed stats per image)
- Per-image picker: set Normal / H-Split / V-Split / Rotate per image
individually,
  with "Apply to all" for bulk assignment

**Advanced Mode (opt-in) — batch (2+ files):**
- JPEG quality presets: 30% / 45% / 60% / 75% / **85%** (default) / 95%
- Auto-download conversion log toggle (aggregated stats for all files)

---

## ⚠️ Known limitations

**KoReader hash-based sync will break** for converted files. The file
content changes,
so the hash no longer matches the original. Filename-based sync is
unaffected.

If you rely on KoReader hash sync, use the Calibre plugin or the web
tool instead.

---
## Build size impact

| Metric | master (53beeee) | PR crosspoint-reader#1224 (a2ba5db) | Delta |

|---------------|------------------|--------------------|----------------|
| Flash used | 5,557 KB | 5,616 KB | +59 KB (+1.1%) |
| Flash free | 843 KB | 784 KB | −59 KB |
| Flash usage | 86.8% | 87.7% | +0.9 pp |
| RAM used | 95,156 B | 95,156 B | no change |

> Both builds compiled with `gh_release` environment in release mode
(ESP32-C3, 6,400 KB Flash).
> The +59 KB increase is entirely due to `jszip.min.js` embedded as a
> gzipped static asset served from Flash. RAM usage is identical,
> confirming no runtime overhead — the library runs in the browser,
> not on the ESP32. ~784 KB of Flash remain available.

---

## Alternatives considered

| Approach | Friction |
|----------|---------|
| **This PR** — integrated in upload flow | Zero: convert + upload in
one step, offline, any browser |
| Calibre plugin (in parallel development) | Requires a computer with
Calibre installed, same network |
| Web converters | Requires extra upload / download / transfer steps |

---

## Credits

Based on the converter algorithm developed by @zgredex.
Co-authored-by: @zgredex

---

### AI Usage

Did you use AI tools to help write this code? **PARTIALLY**

---------

Co-authored-by: zgredex <zgredex@users.noreply.github.com>

* fix: Fix img layout issue / support CSS display:none for elements and images (crosspoint-reader#1443)

## Summary
- Add CSS `display: none` support to the EPUB rendering pipeline (fixes
crosspoint-reader#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

* fix: Overlapping battery percentage on image pages with anti-aliasing (crosspoint-reader#1452)

## Summary

**What is the goal of this PR?**

When viewing a page with images and anti-aliasing enabled, the
`imagePageWithAA` path renders the page twice with fast refreshes (blank
image area, then restore). Both passes called `renderStatusBar()`, which
reads the battery percentage live. If the value changed between the two
renders (e.g. 88% -> 87%), the digits would overlap on screen.
Fix: Removed the redundant `renderStatusBar()` from the second BW
render. The status bar is already drawn and displayed in the first pass,
and only the image area needs restoration.

---

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

* chore: Add powershell script for clang-formatting (crosspoint-reader#1472)

## Summary

* **What is the goal of this PR?** Add a windows equivalent for the
linux clang-format-fix script
* **What changes are included?**

## Additional Context
```
.SYNOPSIS
    Runs clang-format -i on project *.cpp and *.h files.

.DESCRIPTION
    Formats all C/C++ source and header files in the repository, excluding
    generated, vendored, and build directories (open-x4-sdk, builtinFonts,
    hyphenation tries, uzlib, .pio, *.generated.h).

    The clang-format binary path is resolved once and cached in
    .local/clang-format-fix.local. On first run it checks a default path,
    then PATH, then common install locations. Edit the .local file to
    override manually.

.PARAMETER g
    Format only git-modified files (git diff --name-only HEAD) instead of
    the full tree.

.PARAMETER h
    Show this help text.
```
---

### 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? _**< YES >**_

* feat: Make directories stand out more in local file browser: "[dir]" instead of "dir" (crosspoint-reader#1339)

## Summary

* **What is the goal of this PR?** It's difficult to distinguish
directory names from normal file entries, so they are displayed now as
"[dir]" instead of "dir" for classic theme
* **What changes are included?**

## Additional Context

* Add any other information that might be helpful for the reviewer
(e.g., performance implications, potential risks,
  specific areas to focus on).

---

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

* chore: Spanish localization for STR_SHOW_HIDDEN_FILES (crosspoint-reader#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**_

* chore: Turkish localization for STR_SHOW_HIDDEN_FILES (crosspoint-reader#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 crosspoint-reader#1483.

Co-authored-by: Barış Albayrak <barisa@pop-os.lan>

* fix: swedish translation (crosspoint-reader#1476)

## Summary

* **What is the goal of this PR?** 
  fix swedish translation
* **What changes are included?**
  lib\I18n\translations\swedish.yaml
## Additional Context

* Add any other information that might be helpful for the reviewer
(e.g., performance implications, potential risks,
  specific areas to focus on).

---

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

* chore: Catalan localization for STR_SHOW_HIDDEN_FILES (crosspoint-reader#1494)

## Summary

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

Adds the missing Catalan translation for STR_SHOW_HIDDEN_FILES in
lib/I18n/translations/catalan.yaml.

* **What changes are included?**

Only modified catalan.yaml file

## Additional Context

* Add any other information that might be helpful for the reviewer
(e.g., performance implications, potential risks,
  specific areas to focus on).

---

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

* chore: Polish localization for STR_SHOW_HIDDEN_FILES (crosspoint-reader#1490)

## Summary

Polish localization for `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**_

* chore: Update German translation strings (crosspoint-reader#1495)

## Summary

* **What is the goal of this PR?** Updating German language file
* **What changes are included?**

## Additional Context

- None

---

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

* feat: update Russian translation (crosspoint-reader#1489)

## Summary

Adds new Russian strings for recently merged features, yay! 😃 

---

### AI Usage

Did you use AI tools to help write this code? _**NO**_

* feat: Add Ukrainian translations for image-related strings (crosspoint-reader#1491)

## Summary

Prep for RC 1.2.0
crosspoint-reader#1483

* chore: Add missing French translations for UI controls and settings (crosspoint-reader#1493)

Added missing strings for the French translation.

## Summary

Adding the missing French translated strings before the next PR.
No modification done to the preexisting strings, only added new ones.



## Additional Context

N/A

---

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

No AI usage.

* chore: update RO translation for release v1.2.0 (crosspoint-reader#1504)

---------

Co-authored-by: jpirnay <jens@pirnay.com>
Co-authored-by: Zach Nelson <zach@zdnelson.com>
Co-authored-by: Stefan Blixten Karlsson <sbkarlsson@gmail.com>
Co-authored-by: LSTAR <48829261+LSTAR1900@users.noreply.github.com>
Co-authored-by: Jake Kenneally <jakekenneally@gmail.com>
Co-authored-by: Adrian Wilkins-Caruana <38579731+adriancaruana@users.noreply.github.com>
Co-authored-by: Xuan-Son Nguyen <son@huggingface.co>
Co-authored-by: pablohc <pablohc@users.noreply.github.com>
Co-authored-by: zgredex <zgredex@users.noreply.github.com>
Co-authored-by: Dani Poveda <daniphii@outlook.com>
Co-authored-by: Baris Albayrak <80099286+barbarhan@users.noreply.github.com>
Co-authored-by: Barış Albayrak <barisa@pop-os.lan>
Co-authored-by: Àngel <153315454+angeldenom@users.noreply.github.com>
Co-authored-by: Jonasz Potoniec <jonasz@potoniec.eu>
Co-authored-by: Егор Мартынов <martynovegorOF@yandex.ru>
Co-authored-by: Mirus <mirusim@gmail.com>
Co-authored-by: Spigaw <73850535+Spigaw@users.noreply.github.com>
Co-authored-by: ariel-lindemann <41641978+ariel-lindemann@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: GloriaKitchens <43892233+GloriaKitchens@users.noreply.github.com>
razlack pushed a commit to razlack/crosspoint-reader-ble that referenced this pull request Mar 29, 2026
## 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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/6d53ce44-7bae-40c7-b4fb-24f898dbcc05">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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/b98d59fd-47ca-4d3d-a24a-94bf999e957b">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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/2981c411-239b-49a7-b9f7-9a75b6c1b6d3">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
crosspoint-reader/crosspoint-reader#1298 (comment)
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>
razlack pushed a commit to razlack/crosspoint-reader-ble that referenced this pull request Mar 30, 2026
## 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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/6d53ce44-7bae-40c7-b4fb-24f898dbcc05">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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/b98d59fd-47ca-4d3d-a24a-94bf999e957b">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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/2981c411-239b-49a7-b9f7-9a75b6c1b6d3">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
crosspoint-reader/crosspoint-reader#1298 (comment)
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>
razlack pushed a commit to razlack/crosspoint-reader-ble that referenced this pull request Mar 31, 2026
## 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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/6d53ce44-7bae-40c7-b4fb-24f898dbcc05">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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/b98d59fd-47ca-4d3d-a24a-94bf999e957b">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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/2981c411-239b-49a7-b9f7-9a75b6c1b6d3">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
crosspoint-reader/crosspoint-reader#1298 (comment)
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>
razlack pushed a commit to razlack/crosspoint-reader-ble that referenced this pull request Apr 1, 2026
## 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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/6d53ce44-7bae-40c7-b4fb-24f898dbcc05">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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/b98d59fd-47ca-4d3d-a24a-94bf999e957b">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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/2981c411-239b-49a7-b9f7-9a75b6c1b6d3">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
crosspoint-reader/crosspoint-reader#1298 (comment)
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>
razlack pushed a commit to razlack/crosspoint-reader-ble that referenced this pull request Apr 1, 2026
## 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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/6d53ce44-7bae-40c7-b4fb-24f898dbcc05">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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/b98d59fd-47ca-4d3d-a24a-94bf999e957b">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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/2981c411-239b-49a7-b9f7-9a75b6c1b6d3">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
crosspoint-reader/crosspoint-reader#1298 (comment)
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>
znelson added a commit that referenced this pull request Apr 3, 2026
## Summary

It's been a little while since the last release, but the community has
been incredibly busy. With 155 changes from 48 contributors (30 of which
were new!), there was a lot to cover. Here are some of the highlights:

**🔤 Kerning, Ligatures, and Font Improvements**
Text rendering gets a significant upgrade with proper kerning and
ligature support, fixed-point fractional x-advance for more accurate
character placement, and font compression improvements that reduce flash
usage.

**📝 Footnotes**
Footnote anchor navigation lets you select a footnote reference and jump
to the footnote text, then jump back. Slim footnotes support is also
available for books that use inline footnotes.

**📖 EPUB Optimizer**
A new integrated EPUB optimizer can clean up and reprocess books for
better compatibility with the reader, directly from the device.

**🔋 Battery Charging Indicator**
You can now see when your device is actively charging, with a visual
indicator on the battery icon.

**💾 Crash Diagnostics**
When something goes wrong, the firmware now dumps a crash report to the
SD card — even without USB plugged in. This makes it much easier to
report and diagnose issues.

**🌐 New Languages**
The community continues to expand language support. New in this release:
Turkish, Danish, Finnish, Polish, Dutch, Belarusian, Italian, Ukrainian,
Romanian, Catalan, Vietnamese, and Kazakh — along with significant
improvements to existing translations.

**📂 File Management**
Multi-select file deletion, BMP image viewer in the file browser, hidden
directory browsing, and long-click file deletion from the file browser.

**⚡ Performance**
Under the hood, text layout switched from `std::list` to `std::vector`,
HTML entity lookups are now O(log(n)), font rendering is faster, image
decode is 5-20% faster with per-pixel overhead eliminated, and multiple
string allocation hot paths were eliminated. Pre-indexing of the next
chapter also reduces page-turn latency at chapter boundaries.

---

Along with all of the above, there are many other additions including
**WebDAV support**, **auto page turn**, **QR code for current page**,
**split status bar settings**, **screenshot capture**, **JSON-based
settings migration**, **light/dark theme groundwork**, and a long list
of stability fixes and translation improvements.

## What's Changed
### Features
* feat: Support for kerning and ligatures by @znelson in
#873
* feat: footnote anchor navigation by @Uri-Tauber in
#1245
* feat: slim footnotes support by @Uri-Tauber in
#1031
* feat: integrated epub optimizer by @zgredex and @pablohc in
#1224
* feat: battery charging indicator (mirroring PR #537) by @jpirnay in
#1427
* feat: dump crash report to sdcard by @ngxson in
#1145
* feat: Implement silent pre-indexing for the next chapter in
EpubReaderActivity by @LSTAR1900 in
#979
* feat: upgrade platform and support webdav by @dexif in
#1047
* feat: Auto Page Turn for Epub Reader by @GenesiaW in
#1219
* feat: enhance file deletion functionality with multi-select by
@Jessica765 in
#682
* feat: Long Click for File Deletion through File Browser by @Levrk in
#909
* feat: Take screenshots by @el in
#759
* feat: Current page as QR by @el in
#1099
* feat: Download links for web server by @el in
#1039
* feat: Added BmpViewer activity for viewing .bmp images in file browser
by @Levrk in
#887
* feat: User setting for image display by @jpirnay in
#1291
* feat: Show hidden directories in browser by @jpirnay in
#1288
* feat: Prefer ".sleep" over "sleep" for custom image directory by
@jpirnay in
#948
* feat: Allow a local configuration file for custom compiles by @jpirnay
in #879
* feat: Migrate binary settings to json by @jpirnay in
#920
* feat: split status bar setting by @whyte-j in
#733
* feat: wrapped text in GfxRender, implemented in themes so far by
@iandchasse in
#1141
* feat: Themed language screen by @CaptainFrito in
#1020
* feat: set WiFi hostname to CrossPoint-Reader-XXXXXXXXXXXX by @dexif in
#1107
* feat: Add maxAlloc to memory information by @jpirnay in
#1152
* feat: replace picojpeg with JPEGDEC for JPEG image decoding by
@martinbrook in
#1136
* feat: Add git branch to version information on settings screen by
@jpirnay in
#1225
* feat: sort languages in selection menu by @ariel-lindemann in
#1071
* feat: Latin Extended-B European glyphs by @znelson in
#1157
* feat: Latin Extended-B European glyphs by @znelson in
#1167
* feat: Vietnamese glyphs support by @danoooob in
#1147
* feat: add Turkish translation by @barbarhan in
#1192
* feat: add full Danish translation by @hajisan in
#1146
* feat: Add Finnish translations by @plahteenlahti in
#1133
* feat: Add Polish Language by @th0m4sek in
#1155
* feat: add Dutch translation by @basvdploeg in
#1204
* feat: add Belarusian translation by @dexif in
#1120
* feat: Add full Italian translations by @andreaturchet in
#1144
* feat: add Ukrainian translation by @mirus-ua in
#1065
* feat: Add Kazakh (kk) language support by @fsocietyipa in
#1377
* feat: added Romanian strings by @ariel-lindemann in
#987
* feat: add Catalan strings by @angeldenom in
#1049
* feat: Make directories stand out more in local file browser: "[dir]"
instead of "dir" by @jpirnay in
#1339
* feat: Add Polish strings for commits #1219,#1169,#1031 +tweaks by
@th0m4sek in
#1227
* feat: Polish translation tweaks by @th0m4sek in
#1193
### Fixes
* fix: Fix img layout issue / support CSS display:none for elements and
images by @jpirnay in
#1443
* fix: Overlapping battery percentage on image pages with anti-aliasing
by @znelson in
#1452
* fix: Fix prewarm perf when a page contains many styles by
@adriancaruana in
#1451
* fix: use sleep routine from the original firmware by @ngxson in
#1298
* fix: Prevent line breaks on common English contractions by @znelson in
#1405
* fix: Build with -fno-exceptions by @znelson in
#1412
* fix: Reduce flash usage by cleaning up I18n translations by @steka in
#1401
* fix: jpeg resource cleanup by @jpirnay in
#1320
* fix: back button in settings returns to tab bar first by @Cache8063 in
#1354
* fix: Init lastSleepImage (edge case) by @jpirnay in
#1360
* fix: Add special handling for apostrophe hyphenation by @jpirnay in
#1318
* fix: Fix inter-word spacing rounding error in text layout by @znelson
in #1311
* fix: load access fault crash by @Uri-Tauber in
#1370
* fix: Fix bootloop logging crash by @jpirnay in
#1357
* fix: dump crash log without usb plugged, bump release log to INFO by
@ngxson in
#1332
* fix: avoid zip filename overflow by @jpirnay in
#1321
* fix: Hanging indent (negative text-indent) and em-unit sizing by
@jpirnay in
#1229
* fix: Use fixed-point fractional x-advance and kerning for better text
layout by @znelson in
#1168
* fix: use HTTPClient::writeToStream for downloading files from OPDS by
@osteotek in
#1207
* fix: make file system operations thread-safe (HalFile) by @ngxson in
#1212
* fix: properly implement requestUpdateAndWait() by @ngxson in
#1218
* fix: prevent infinite render loop in Calibre Wireless after file
transfer by @pablohc in
#1070
* fix: WiFi lifecycle and hyphenation heap defragmentation for KOReader
sync by @jpirnay in
#1151
* fix: Fix coverRendered flag by @jpirnay in
#1154
* fix: Handle non-ASCII characters in sanitizeFilename by @znelson in
#1132
* fix: Update activity was missing "Back" button label by @znelson in
#1128
* fix: force auto-hinting for Bookerly to fix inconsistent stem widths
by @adriancaruana in
#1098
* fix: image centering bleed by @martinbrook in
#1096
* fix: double free WebDAVHandler by @ngxson in
#1093
* fix: Consider extra quotation styles when hyphenating quoted words by
@cbix in
#1077
* fix: acquire power lock before sleeping by @ngxson in
#1125
* fix: Unify inconsistent Wi-Fi/WiFi in Czech translation by @pepastach
in #1138
* fix: sdfat warning about redefinition of macro by @ngxson in
#1135
* fix: Close leaked file descriptors in SleepActivity and web server by
@brbla in
#869
* fix: Enable DESTRUCTOR_CLOSES_FILE flag by @daveallie in
#1075
* fix: Change "UI Font Size" to "Reader Font Size" by @divinitycove in
#1171
* fix: Hide unusable button hints when viewing empty directory by @Levrk
in #1253
* fix: broken translations in status bar settings by @ariel-lindemann in
#1188
* fix: clarity issue with ambiguous string `SET` by @ariel-lindemann in
#1169
* fix: Crash (Load access fault) when indexing chapters containing
characters unsupported by bold/italic font variants by @Uri-Tauber in
#997
* fix: Increase PNGdec buffer size to support wide images by @osteotek
in #995
* fix: Use HalPowerManager for battery percentage by @vjapolitzer in
#1005
* fix: Fix dangling pointer by @Uri-Tauber in
#1010
* fix: re-implementing Cover Outlines for the new Lyra Themes by @Levrk
in #1017
* fix: use double FAST_REFRESH to prevent washout on large grey images
by @martinbrook in
#957
* fix: Fixed Image Sizing When No Width is Set by @DestinySpeaker in
#1002
* fix: Strip unused CSS rules by @daveallie in
#1014
* fix: continue reading card classic theme by @pablohc in
#990
* fix: Destroy CSS Cache file when invalid by @daveallie in
#1018
* fix: Shorten "Forget Wifi" button labels to fit on button by
@lukestein in
#1045
* fix: improve Spanish translations by @pablohc in
#1054
* fix: Fixed book title in home screen by @DestinySpeaker in
#1013
* fix: Fix hyphenation and rendering of decomposed characters by
@jpirnay in
#1037
* fix: Improve and add Spanish translations by @DaniPhii in
#1338
* fix: improve and add Spanish translations by @DaniPhii in
#1254
* fix: improve and add Swedish translations by @steka in
#1317
* fix: Extend missing / amend existing German translations by @jpirnay
in #1226
* fix: update french.yaml file to have a better French translation of
the CFW by @Spigaw in
#1130
* fix: added romanian translation to new strings by @ariel-lindemann in
#1105
* fix: add missing romanian strings by @ariel-lindemann in
#1187
* fix: add new Ukrainian translation line for STR_SCREENSHOT_BUTTON by
@mirus-ua in
#1149
* fix: Dutch translation prefix correction by @basvdploeg in
#1223
* fix: Small typo in i18n.md regarding C++ identifiers by
@victordomingos in
#1210
* fix: typo in USER_GUIDE.md by @arnaugamez in
#1036
* fix: add missing keyboard metrics to Lyra3CoversTheme by @dexif in
#1101

### Internal
* perf: font-compression improvements by @adriancaruana in
#1056
* perf: Improve font drawing performance by @jpirnay in
#978
* perf: Replace std::list with std::vector in text layout by @znelson in
#1038
* perf: Optimize HTML entities lookup to O(log(n)) by @Uri-Tauber in
#1194
* perf: UITheme::getMetrics const and const-ref usage by @znelson in
#1094
* perf: Avoid creating strings for file extension checks by @znelson in
#1303
* perf: Eliminate per-pixel overheads in image rendering by @martinbrook
in #1293
* perf: Update github actions for optimal performance with pioarduino by
@Jason2866 in
#1080
* style: Phase 1 - Simple light dark themes by @cdmoro in
#1006
* refactor: implement ActivityManager by @ngxson in
#1016
* refactor: Simplify REPLACEMENT_GLYPH fallback by @znelson in
#1119
* refactor: Simplify new setting introduction by @jpirnay in
#1086
* refactor: Use std binary search algorithms for font lookups by
@znelson in
#1202
* refactor: rename MyLibrary to FileBrowser by @osteotek in
#1260
* refactor: Avoid rebuilding cache path strings by @znelson in
#1300
* refactor: reader utils by @Uri-Tauber in
#1329
* chore: Remove miniz and modularise inflation logic by @daveallie in
#1073
* chore: Resolve several build warnings by @daveallie in
#1076
* chore: Removed generated language headers by @znelson in
#1156
* chore: Added generated lang headers to .gitignore by @znelson in
#1158
* chore: remove redundant xTaskCreate by @ngxson in
#1264
* chore: Removed unused PlatformIO include directory placeholder by
@znelson in
#1417
* chore: micro-optimisation: early exit on fillUncompressedSizes by
@jpirnay in
#1322
* chore: change label while on settings tab actions by @jpirnay in
#1325
* chore: add firmware size history script by @znelson in
#1235
* chore: Add powershell script for clang-formatting by @jpirnay in
#1472
* chore: Removed unused ConfirmationActivity member by @znelson in
#1234
* chore: Update russian.yaml by @madebyKir in
#1198
* chore: new Ukrainian translation lines by @mirus-ua in
#1199
* chore: new Ukrainian localization strings by @mirus-ua in
#1270
* chore: Polish localization for STR_DELETE by @JonaszPotoniec in
#1323
* chore: Image settings Polish localization by @znelson in
#1299
* chore: add missing Catalan strings by @angeldenom in
#1302
* chore: add missing translations for Romanian by @ariel-lindemann in
#1265
* chore: Add Portuguese (Portugal) translator to the list by
@victordomingos in
#1211
* chore: Reduce flash usage by cleaning up I18n translations by @steka
in #1401
* docs: Add lightweight contributor onboarding documentation by @bilalix
in #894
* docs: ActivityManager migration guide by @znelson in
#1222
* docs: USER_GUIDE.md update for 1.1.0 by @divinitycove in
#1108
* docs: add quick KOReader sync setup guide by @wjhrdy in
#1181
* docs: image support marked as completed by @ariel-lindemann in
#1008
* feat: aiagent context definition by @jpirnay in
#922
* chore: Update SKILL.md to reflect generated i18n files are gitignored
by @znelson in
#1423
* fix: ActivityManager tweaks by @znelson in
#1220
* fix: Correct relative file paths in SKILL.md documentation by @pablohc
in #1304
* fix: add Technically Unsupported section to SCOPE.md by @Uri-Tauber in
#1295

## New Contributors
* @DestinySpeaker made their first contribution in
#1002
* @arnaugamez made their first contribution in
#1036
* @angeldenom made their first contribution in
#1049
* @cdmoro made their first contribution in
#1006
* @bilalix made their first contribution in
#894
* @Jessica765 made their first contribution in
#682
* @brbla made their first contribution in
#869
* @dexif made their first contribution in
#1047
* @mirus-ua made their first contribution in
#1065
* @cbix made their first contribution in
#1077
* @divinitycove made their first contribution in
#1108
* @pepastach made their first contribution in
#1138
* @Jason2866 made their first contribution in
#1080
* @andreaturchet made their first contribution in
#1144
* @Spigaw made their first contribution in
#1130
* @iandchasse made their first contribution in
#1141
* @th0m4sek made their first contribution in
#1155
* @plahteenlahti made their first contribution in
#1133
* @hajisan made their first contribution in
#1146
* @madebyKir made their first contribution in
#1198
* @victordomingos made their first contribution in
#1210
* @basvdploeg made their first contribution in
#1204
* @wjhrdy made their first contribution in
#1181
* @DaniPhii made their first contribution in
#1254
* @steka made their first contribution in
#1317
* @barbarhan made their first contribution in
#1192
* @JonaszPotoniec made their first contribution in
#1323
* @Cache8063 made their first contribution in
#1354
* @fsocietyipa made their first contribution in
#1377
* @LSTAR1900 made their first contribution in
#979
* @zgredex made their first contribution in
#1224

**Full Changelog**:
1.1.1...release/1.2.0

---------

Co-authored-by: jpirnay <jens@pirnay.com>
Co-authored-by: Dani Poveda <daniphii@outlook.com>
Co-authored-by: Baris Albayrak <80099286+barbarhan@users.noreply.github.com>
Co-authored-by: Barış Albayrak <barisa@pop-os.lan>
Co-authored-by: Stefan Blixten Karlsson <sbkarlsson@gmail.com>
Co-authored-by: Àngel <153315454+angeldenom@users.noreply.github.com>
Co-authored-by: Jonasz Potoniec <jonasz@potoniec.eu>
Co-authored-by: Егор Мартынов <martynovegorOF@yandex.ru>
Co-authored-by: Mirus <mirusim@gmail.com>
Co-authored-by: Spigaw <73850535+Spigaw@users.noreply.github.com>
Co-authored-by: ariel-lindemann <41641978+ariel-lindemann@users.noreply.github.com>
Co-authored-by: Nima Salami <54304457+hajisan@users.noreply.github.com>
Co-authored-by: Arthur Tazhitdinov <lisnake@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Bas van der Ploeg <bas@basvanderploeg.nl>
Co-authored-by: martin brook <martin.brook100@googlemail.com>
Unintendedsideeffects pushed a commit to Unintendedsideeffects/ForkDrift-crosspointReader that referenced this pull request Apr 4, 2026
…1298)

## Summary

Fixes crosspoint-reader#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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/6d53ce44-7bae-40c7-b4fb-24f898dbcc05">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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/b98d59fd-47ca-4d3d-a24a-94bf999e957b">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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/2981c411-239b-49a7-b9f7-9a75b6c1b6d3">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
crosspoint-reader#1298 (comment)
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>
Unintendedsideeffects pushed a commit to Unintendedsideeffects/ForkDrift-crosspointReader that referenced this pull request Apr 4, 2026
It's been a little while since the last release, but the community has
been incredibly busy. With 155 changes from 48 contributors (30 of which
were new!), there was a lot to cover. Here are some of the highlights:

**🔤 Kerning, Ligatures, and Font Improvements**
Text rendering gets a significant upgrade with proper kerning and
ligature support, fixed-point fractional x-advance for more accurate
character placement, and font compression improvements that reduce flash
usage.

**📝 Footnotes**
Footnote anchor navigation lets you select a footnote reference and jump
to the footnote text, then jump back. Slim footnotes support is also
available for books that use inline footnotes.

**📖 EPUB Optimizer**
A new integrated EPUB optimizer can clean up and reprocess books for
better compatibility with the reader, directly from the device.

**🔋 Battery Charging Indicator**
You can now see when your device is actively charging, with a visual
indicator on the battery icon.

**💾 Crash Diagnostics**
When something goes wrong, the firmware now dumps a crash report to the
SD card — even without USB plugged in. This makes it much easier to
report and diagnose issues.

**🌐 New Languages**
The community continues to expand language support. New in this release:
Turkish, Danish, Finnish, Polish, Dutch, Belarusian, Italian, Ukrainian,
Romanian, Catalan, Vietnamese, and Kazakh — along with significant
improvements to existing translations.

**📂 File Management**
Multi-select file deletion, BMP image viewer in the file browser, hidden
directory browsing, and long-click file deletion from the file browser.

**⚡ Performance**
Under the hood, text layout switched from `std::list` to `std::vector`,
HTML entity lookups are now O(log(n)), font rendering is faster, image
decode is 5-20% faster with per-pixel overhead eliminated, and multiple
string allocation hot paths were eliminated. Pre-indexing of the next
chapter also reduces page-turn latency at chapter boundaries.

---

Along with all of the above, there are many other additions including
**WebDAV support**, **auto page turn**, **QR code for current page**,
**split status bar settings**, **screenshot capture**, **JSON-based
settings migration**, **light/dark theme groundwork**, and a long list
of stability fixes and translation improvements.

* feat: Support for kerning and ligatures by @znelson in
crosspoint-reader#873
* feat: footnote anchor navigation by @Uri-Tauber in
crosspoint-reader#1245
* feat: slim footnotes support by @Uri-Tauber in
crosspoint-reader#1031
* feat: integrated epub optimizer by @zgredex and @pablohc in
crosspoint-reader#1224
* feat: battery charging indicator (mirroring PR crosspoint-reader#537) by @jpirnay in
crosspoint-reader#1427
* feat: dump crash report to sdcard by @ngxson in
crosspoint-reader#1145
* feat: Implement silent pre-indexing for the next chapter in
EpubReaderActivity by @LSTAR1900 in
crosspoint-reader#979
* feat: upgrade platform and support webdav by @dexif in
crosspoint-reader#1047
* feat: Auto Page Turn for Epub Reader by @GenesiaW in
crosspoint-reader#1219
* feat: enhance file deletion functionality with multi-select by
@Jessica765 in
crosspoint-reader#682
* feat: Long Click for File Deletion through File Browser by @Levrk in
crosspoint-reader#909
* feat: Take screenshots by @el in
crosspoint-reader#759
* feat: Current page as QR by @el in
crosspoint-reader#1099
* feat: Download links for web server by @el in
crosspoint-reader#1039
* feat: Added BmpViewer activity for viewing .bmp images in file browser
by @Levrk in
crosspoint-reader#887
* feat: User setting for image display by @jpirnay in
crosspoint-reader#1291
* feat: Show hidden directories in browser by @jpirnay in
crosspoint-reader#1288
* feat: Prefer ".sleep" over "sleep" for custom image directory by
@jpirnay in
crosspoint-reader#948
* feat: Allow a local configuration file for custom compiles by @jpirnay
in crosspoint-reader#879
* feat: Migrate binary settings to json by @jpirnay in
crosspoint-reader#920
* feat: split status bar setting by @whyte-j in
crosspoint-reader#733
* feat: wrapped text in GfxRender, implemented in themes so far by
@iandchasse in
crosspoint-reader#1141
* feat: Themed language screen by @CaptainFrito in
crosspoint-reader#1020
* feat: set WiFi hostname to CrossPoint-Reader-XXXXXXXXXXXX by @dexif in
crosspoint-reader#1107
* feat: Add maxAlloc to memory information by @jpirnay in
crosspoint-reader#1152
* feat: replace picojpeg with JPEGDEC for JPEG image decoding by
@martinbrook in
crosspoint-reader#1136
* feat: Add git branch to version information on settings screen by
@jpirnay in
crosspoint-reader#1225
* feat: sort languages in selection menu by @ariel-lindemann in
crosspoint-reader#1071
* feat: Latin Extended-B European glyphs by @znelson in
crosspoint-reader#1157
* feat: Latin Extended-B European glyphs by @znelson in
crosspoint-reader#1167
* feat: Vietnamese glyphs support by @danoooob in
crosspoint-reader#1147
* feat: add Turkish translation by @barbarhan in
crosspoint-reader#1192
* feat: add full Danish translation by @hajisan in
crosspoint-reader#1146
* feat: Add Finnish translations by @plahteenlahti in
crosspoint-reader#1133
* feat: Add Polish Language by @th0m4sek in
crosspoint-reader#1155
* feat: add Dutch translation by @basvdploeg in
crosspoint-reader#1204
* feat: add Belarusian translation by @dexif in
crosspoint-reader#1120
* feat: Add full Italian translations by @andreaturchet in
crosspoint-reader#1144
* feat: add Ukrainian translation by @mirus-ua in
crosspoint-reader#1065
* feat: Add Kazakh (kk) language support by @fsocietyipa in
crosspoint-reader#1377
* feat: added Romanian strings by @ariel-lindemann in
crosspoint-reader#987
* feat: add Catalan strings by @angeldenom in
crosspoint-reader#1049
* feat: Make directories stand out more in local file browser: "[dir]"
instead of "dir" by @jpirnay in
crosspoint-reader#1339
* feat: Add Polish strings for commits crosspoint-reader#1219,crosspoint-reader#1169,crosspoint-reader#1031 +tweaks by
@th0m4sek in
crosspoint-reader#1227
* feat: Polish translation tweaks by @th0m4sek in
crosspoint-reader#1193
* fix: Fix img layout issue / support CSS display:none for elements and
images by @jpirnay in
crosspoint-reader#1443
* fix: Overlapping battery percentage on image pages with anti-aliasing
by @znelson in
crosspoint-reader#1452
* fix: Fix prewarm perf when a page contains many styles by
@adriancaruana in
crosspoint-reader#1451
* fix: use sleep routine from the original firmware by @ngxson in
crosspoint-reader#1298
* fix: Prevent line breaks on common English contractions by @znelson in
crosspoint-reader#1405
* fix: Build with -fno-exceptions by @znelson in
crosspoint-reader#1412
* fix: Reduce flash usage by cleaning up I18n translations by @steka in
crosspoint-reader#1401
* fix: jpeg resource cleanup by @jpirnay in
crosspoint-reader#1320
* fix: back button in settings returns to tab bar first by @Cache8063 in
crosspoint-reader#1354
* fix: Init lastSleepImage (edge case) by @jpirnay in
crosspoint-reader#1360
* fix: Add special handling for apostrophe hyphenation by @jpirnay in
crosspoint-reader#1318
* fix: Fix inter-word spacing rounding error in text layout by @znelson
in crosspoint-reader#1311
* fix: load access fault crash by @Uri-Tauber in
crosspoint-reader#1370
* fix: Fix bootloop logging crash by @jpirnay in
crosspoint-reader#1357
* fix: dump crash log without usb plugged, bump release log to INFO by
@ngxson in
crosspoint-reader#1332
* fix: avoid zip filename overflow by @jpirnay in
crosspoint-reader#1321
* fix: Hanging indent (negative text-indent) and em-unit sizing by
@jpirnay in
crosspoint-reader#1229
* fix: Use fixed-point fractional x-advance and kerning for better text
layout by @znelson in
crosspoint-reader#1168
* fix: use HTTPClient::writeToStream for downloading files from OPDS by
@osteotek in
crosspoint-reader#1207
* fix: make file system operations thread-safe (HalFile) by @ngxson in
crosspoint-reader#1212
* fix: properly implement requestUpdateAndWait() by @ngxson in
crosspoint-reader#1218
* fix: prevent infinite render loop in Calibre Wireless after file
transfer by @pablohc in
crosspoint-reader#1070
* fix: WiFi lifecycle and hyphenation heap defragmentation for KOReader
sync by @jpirnay in
crosspoint-reader#1151
* fix: Fix coverRendered flag by @jpirnay in
crosspoint-reader#1154
* fix: Handle non-ASCII characters in sanitizeFilename by @znelson in
crosspoint-reader#1132
* fix: Update activity was missing "Back" button label by @znelson in
crosspoint-reader#1128
* fix: force auto-hinting for Bookerly to fix inconsistent stem widths
by @adriancaruana in
crosspoint-reader#1098
* fix: image centering bleed by @martinbrook in
crosspoint-reader#1096
* fix: double free WebDAVHandler by @ngxson in
crosspoint-reader#1093
* fix: Consider extra quotation styles when hyphenating quoted words by
@cbix in
crosspoint-reader#1077
* fix: acquire power lock before sleeping by @ngxson in
crosspoint-reader#1125
* fix: Unify inconsistent Wi-Fi/WiFi in Czech translation by @pepastach
in crosspoint-reader#1138
* fix: sdfat warning about redefinition of macro by @ngxson in
crosspoint-reader#1135
* fix: Close leaked file descriptors in SleepActivity and web server by
@brbla in
crosspoint-reader#869
* fix: Enable DESTRUCTOR_CLOSES_FILE flag by @daveallie in
crosspoint-reader#1075
* fix: Change "UI Font Size" to "Reader Font Size" by @divinitycove in
crosspoint-reader#1171
* fix: Hide unusable button hints when viewing empty directory by @Levrk
in crosspoint-reader#1253
* fix: broken translations in status bar settings by @ariel-lindemann in
crosspoint-reader#1188
* fix: clarity issue with ambiguous string `SET` by @ariel-lindemann in
crosspoint-reader#1169
* fix: Crash (Load access fault) when indexing chapters containing
characters unsupported by bold/italic font variants by @Uri-Tauber in
crosspoint-reader#997
* fix: Increase PNGdec buffer size to support wide images by @osteotek
in crosspoint-reader#995
* fix: Use HalPowerManager for battery percentage by @vjapolitzer in
crosspoint-reader#1005
* fix: Fix dangling pointer by @Uri-Tauber in
crosspoint-reader#1010
* fix: re-implementing Cover Outlines for the new Lyra Themes by @Levrk
in crosspoint-reader#1017
* fix: use double FAST_REFRESH to prevent washout on large grey images
by @martinbrook in
crosspoint-reader#957
* fix: Fixed Image Sizing When No Width is Set by @DestinySpeaker in
crosspoint-reader#1002
* fix: Strip unused CSS rules by @daveallie in
crosspoint-reader#1014
* fix: continue reading card classic theme by @pablohc in
crosspoint-reader#990
* fix: Destroy CSS Cache file when invalid by @daveallie in
crosspoint-reader#1018
* fix: Shorten "Forget Wifi" button labels to fit on button by
@lukestein in
crosspoint-reader#1045
* fix: improve Spanish translations by @pablohc in
crosspoint-reader#1054
* fix: Fixed book title in home screen by @DestinySpeaker in
crosspoint-reader#1013
* fix: Fix hyphenation and rendering of decomposed characters by
@jpirnay in
crosspoint-reader#1037
* fix: Improve and add Spanish translations by @DaniPhii in
crosspoint-reader#1338
* fix: improve and add Spanish translations by @DaniPhii in
crosspoint-reader#1254
* fix: improve and add Swedish translations by @steka in
crosspoint-reader#1317
* fix: Extend missing / amend existing German translations by @jpirnay
in crosspoint-reader#1226
* fix: update french.yaml file to have a better French translation of
the CFW by @Spigaw in
crosspoint-reader#1130
* fix: added romanian translation to new strings by @ariel-lindemann in
crosspoint-reader#1105
* fix: add missing romanian strings by @ariel-lindemann in
crosspoint-reader#1187
* fix: add new Ukrainian translation line for STR_SCREENSHOT_BUTTON by
@mirus-ua in
crosspoint-reader#1149
* fix: Dutch translation prefix correction by @basvdploeg in
crosspoint-reader#1223
* fix: Small typo in i18n.md regarding C++ identifiers by
@victordomingos in
crosspoint-reader#1210
* fix: typo in USER_GUIDE.md by @arnaugamez in
crosspoint-reader#1036
* fix: add missing keyboard metrics to Lyra3CoversTheme by @dexif in
crosspoint-reader#1101

* perf: font-compression improvements by @adriancaruana in
crosspoint-reader#1056
* perf: Improve font drawing performance by @jpirnay in
crosspoint-reader#978
* perf: Replace std::list with std::vector in text layout by @znelson in
crosspoint-reader#1038
* perf: Optimize HTML entities lookup to O(log(n)) by @Uri-Tauber in
crosspoint-reader#1194
* perf: UITheme::getMetrics const and const-ref usage by @znelson in
crosspoint-reader#1094
* perf: Avoid creating strings for file extension checks by @znelson in
crosspoint-reader#1303
* perf: Eliminate per-pixel overheads in image rendering by @martinbrook
in crosspoint-reader#1293
* perf: Update github actions for optimal performance with pioarduino by
@Jason2866 in
crosspoint-reader#1080
* style: Phase 1 - Simple light dark themes by @cdmoro in
crosspoint-reader#1006
* refactor: implement ActivityManager by @ngxson in
crosspoint-reader#1016
* refactor: Simplify REPLACEMENT_GLYPH fallback by @znelson in
crosspoint-reader#1119
* refactor: Simplify new setting introduction by @jpirnay in
crosspoint-reader#1086
* refactor: Use std binary search algorithms for font lookups by
@znelson in
crosspoint-reader#1202
* refactor: rename MyLibrary to FileBrowser by @osteotek in
crosspoint-reader#1260
* refactor: Avoid rebuilding cache path strings by @znelson in
crosspoint-reader#1300
* refactor: reader utils by @Uri-Tauber in
crosspoint-reader#1329
* chore: Remove miniz and modularise inflation logic by @daveallie in
crosspoint-reader#1073
* chore: Resolve several build warnings by @daveallie in
crosspoint-reader#1076
* chore: Removed generated language headers by @znelson in
crosspoint-reader#1156
* chore: Added generated lang headers to .gitignore by @znelson in
crosspoint-reader#1158
* chore: remove redundant xTaskCreate by @ngxson in
crosspoint-reader#1264
* chore: Removed unused PlatformIO include directory placeholder by
@znelson in
crosspoint-reader#1417
* chore: micro-optimisation: early exit on fillUncompressedSizes by
@jpirnay in
crosspoint-reader#1322
* chore: change label while on settings tab actions by @jpirnay in
crosspoint-reader#1325
* chore: add firmware size history script by @znelson in
crosspoint-reader#1235
* chore: Add powershell script for clang-formatting by @jpirnay in
crosspoint-reader#1472
* chore: Removed unused ConfirmationActivity member by @znelson in
crosspoint-reader#1234
* chore: Update russian.yaml by @madebyKir in
crosspoint-reader#1198
* chore: new Ukrainian translation lines by @mirus-ua in
crosspoint-reader#1199
* chore: new Ukrainian localization strings by @mirus-ua in
crosspoint-reader#1270
* chore: Polish localization for STR_DELETE by @JonaszPotoniec in
crosspoint-reader#1323
* chore: Image settings Polish localization by @znelson in
crosspoint-reader#1299
* chore: add missing Catalan strings by @angeldenom in
crosspoint-reader#1302
* chore: add missing translations for Romanian by @ariel-lindemann in
crosspoint-reader#1265
* chore: Add Portuguese (Portugal) translator to the list by
@victordomingos in
crosspoint-reader#1211
* chore: Reduce flash usage by cleaning up I18n translations by @steka
in crosspoint-reader#1401
* docs: Add lightweight contributor onboarding documentation by @bilalix
in crosspoint-reader#894
* docs: ActivityManager migration guide by @znelson in
crosspoint-reader#1222
* docs: USER_GUIDE.md update for 1.1.0 by @divinitycove in
crosspoint-reader#1108
* docs: add quick KOReader sync setup guide by @wjhrdy in
crosspoint-reader#1181
* docs: image support marked as completed by @ariel-lindemann in
crosspoint-reader#1008
* feat: aiagent context definition by @jpirnay in
crosspoint-reader#922
* chore: Update SKILL.md to reflect generated i18n files are gitignored
by @znelson in
crosspoint-reader#1423
* fix: ActivityManager tweaks by @znelson in
crosspoint-reader#1220
* fix: Correct relative file paths in SKILL.md documentation by @pablohc
in crosspoint-reader#1304
* fix: add Technically Unsupported section to SCOPE.md by @Uri-Tauber in
crosspoint-reader#1295

* @DestinySpeaker made their first contribution in
crosspoint-reader#1002
* @arnaugamez made their first contribution in
crosspoint-reader#1036
* @angeldenom made their first contribution in
crosspoint-reader#1049
* @cdmoro made their first contribution in
crosspoint-reader#1006
* @bilalix made their first contribution in
crosspoint-reader#894
* @Jessica765 made their first contribution in
crosspoint-reader#682
* @brbla made their first contribution in
crosspoint-reader#869
* @dexif made their first contribution in
crosspoint-reader#1047
* @mirus-ua made their first contribution in
crosspoint-reader#1065
* @cbix made their first contribution in
crosspoint-reader#1077
* @divinitycove made their first contribution in
crosspoint-reader#1108
* @pepastach made their first contribution in
crosspoint-reader#1138
* @Jason2866 made their first contribution in
crosspoint-reader#1080
* @andreaturchet made their first contribution in
crosspoint-reader#1144
* @Spigaw made their first contribution in
crosspoint-reader#1130
* @iandchasse made their first contribution in
crosspoint-reader#1141
* @th0m4sek made their first contribution in
crosspoint-reader#1155
* @plahteenlahti made their first contribution in
crosspoint-reader#1133
* @hajisan made their first contribution in
crosspoint-reader#1146
* @madebyKir made their first contribution in
crosspoint-reader#1198
* @victordomingos made their first contribution in
crosspoint-reader#1210
* @basvdploeg made their first contribution in
crosspoint-reader#1204
* @wjhrdy made their first contribution in
crosspoint-reader#1181
* @DaniPhii made their first contribution in
crosspoint-reader#1254
* @steka made their first contribution in
crosspoint-reader#1317
* @barbarhan made their first contribution in
crosspoint-reader#1192
* @JonaszPotoniec made their first contribution in
crosspoint-reader#1323
* @Cache8063 made their first contribution in
crosspoint-reader#1354
* @fsocietyipa made their first contribution in
crosspoint-reader#1377
* @LSTAR1900 made their first contribution in
crosspoint-reader#979
* @zgredex made their first contribution in
crosspoint-reader#1224

**Full Changelog**:
crosspoint-reader/crosspoint-reader@1.1.1...release/1.2.0

---------

Co-authored-by: jpirnay <jens@pirnay.com>
Co-authored-by: Dani Poveda <daniphii@outlook.com>
Co-authored-by: Baris Albayrak <80099286+barbarhan@users.noreply.github.com>
Co-authored-by: Barış Albayrak <barisa@pop-os.lan>
Co-authored-by: Stefan Blixten Karlsson <sbkarlsson@gmail.com>
Co-authored-by: Àngel <153315454+angeldenom@users.noreply.github.com>
Co-authored-by: Jonasz Potoniec <jonasz@potoniec.eu>
Co-authored-by: Егор Мартынов <martynovegorOF@yandex.ru>
Co-authored-by: Mirus <mirusim@gmail.com>
Co-authored-by: Spigaw <73850535+Spigaw@users.noreply.github.com>
Co-authored-by: ariel-lindemann <41641978+ariel-lindemann@users.noreply.github.com>
Co-authored-by: Nima Salami <54304457+hajisan@users.noreply.github.com>
Co-authored-by: Arthur Tazhitdinov <lisnake@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Bas van der Ploeg <bas@basvanderploeg.nl>
Co-authored-by: martin brook <martin.brook100@googlemail.com>
lukestein pushed a commit to lukestein/crosspoint-reader that referenced this pull request Apr 7, 2026
…1298)

## Summary

Fixes crosspoint-reader#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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/6d53ce44-7bae-40c7-b4fb-24f898dbcc05">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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/b98d59fd-47ca-4d3d-a24a-94bf999e957b">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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/2981c411-239b-49a7-b9f7-9a75b6c1b6d3">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
crosspoint-reader#1298 (comment)
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>
lukestein pushed a commit to lukestein/crosspoint-reader that referenced this pull request Apr 7, 2026
## Summary

It's been a little while since the last release, but the community has
been incredibly busy. With 155 changes from 48 contributors (30 of which
were new!), there was a lot to cover. Here are some of the highlights:

**🔤 Kerning, Ligatures, and Font Improvements**
Text rendering gets a significant upgrade with proper kerning and
ligature support, fixed-point fractional x-advance for more accurate
character placement, and font compression improvements that reduce flash
usage.

**📝 Footnotes**
Footnote anchor navigation lets you select a footnote reference and jump
to the footnote text, then jump back. Slim footnotes support is also
available for books that use inline footnotes.

**📖 EPUB Optimizer**
A new integrated EPUB optimizer can clean up and reprocess books for
better compatibility with the reader, directly from the device.

**🔋 Battery Charging Indicator**
You can now see when your device is actively charging, with a visual
indicator on the battery icon.

**💾 Crash Diagnostics**
When something goes wrong, the firmware now dumps a crash report to the
SD card — even without USB plugged in. This makes it much easier to
report and diagnose issues.

**🌐 New Languages**
The community continues to expand language support. New in this release:
Turkish, Danish, Finnish, Polish, Dutch, Belarusian, Italian, Ukrainian,
Romanian, Catalan, Vietnamese, and Kazakh — along with significant
improvements to existing translations.

**📂 File Management**
Multi-select file deletion, BMP image viewer in the file browser, hidden
directory browsing, and long-click file deletion from the file browser.

**⚡ Performance**
Under the hood, text layout switched from `std::list` to `std::vector`,
HTML entity lookups are now O(log(n)), font rendering is faster, image
decode is 5-20% faster with per-pixel overhead eliminated, and multiple
string allocation hot paths were eliminated. Pre-indexing of the next
chapter also reduces page-turn latency at chapter boundaries.

---

Along with all of the above, there are many other additions including
**WebDAV support**, **auto page turn**, **QR code for current page**,
**split status bar settings**, **screenshot capture**, **JSON-based
settings migration**, **light/dark theme groundwork**, and a long list
of stability fixes and translation improvements.

## What's Changed
### Features
* feat: Support for kerning and ligatures by @znelson in
crosspoint-reader#873
* feat: footnote anchor navigation by @Uri-Tauber in
crosspoint-reader#1245
* feat: slim footnotes support by @Uri-Tauber in
crosspoint-reader#1031
* feat: integrated epub optimizer by @zgredex and @pablohc in
crosspoint-reader#1224
* feat: battery charging indicator (mirroring PR crosspoint-reader#537) by @jpirnay in
crosspoint-reader#1427
* feat: dump crash report to sdcard by @ngxson in
crosspoint-reader#1145
* feat: Implement silent pre-indexing for the next chapter in
EpubReaderActivity by @LSTAR1900 in
crosspoint-reader#979
* feat: upgrade platform and support webdav by @dexif in
crosspoint-reader#1047
* feat: Auto Page Turn for Epub Reader by @GenesiaW in
crosspoint-reader#1219
* feat: enhance file deletion functionality with multi-select by
@Jessica765 in
crosspoint-reader#682
* feat: Long Click for File Deletion through File Browser by @Levrk in
crosspoint-reader#909
* feat: Take screenshots by @el in
crosspoint-reader#759
* feat: Current page as QR by @el in
crosspoint-reader#1099
* feat: Download links for web server by @el in
crosspoint-reader#1039
* feat: Added BmpViewer activity for viewing .bmp images in file browser
by @Levrk in
crosspoint-reader#887
* feat: User setting for image display by @jpirnay in
crosspoint-reader#1291
* feat: Show hidden directories in browser by @jpirnay in
crosspoint-reader#1288
* feat: Prefer ".sleep" over "sleep" for custom image directory by
@jpirnay in
crosspoint-reader#948
* feat: Allow a local configuration file for custom compiles by @jpirnay
in crosspoint-reader#879
* feat: Migrate binary settings to json by @jpirnay in
crosspoint-reader#920
* feat: split status bar setting by @whyte-j in
crosspoint-reader#733
* feat: wrapped text in GfxRender, implemented in themes so far by
@iandchasse in
crosspoint-reader#1141
* feat: Themed language screen by @CaptainFrito in
crosspoint-reader#1020
* feat: set WiFi hostname to CrossPoint-Reader-XXXXXXXXXXXX by @dexif in
crosspoint-reader#1107
* feat: Add maxAlloc to memory information by @jpirnay in
crosspoint-reader#1152
* feat: replace picojpeg with JPEGDEC for JPEG image decoding by
@martinbrook in
crosspoint-reader#1136
* feat: Add git branch to version information on settings screen by
@jpirnay in
crosspoint-reader#1225
* feat: sort languages in selection menu by @ariel-lindemann in
crosspoint-reader#1071
* feat: Latin Extended-B European glyphs by @znelson in
crosspoint-reader#1157
* feat: Latin Extended-B European glyphs by @znelson in
crosspoint-reader#1167
* feat: Vietnamese glyphs support by @danoooob in
crosspoint-reader#1147
* feat: add Turkish translation by @barbarhan in
crosspoint-reader#1192
* feat: add full Danish translation by @hajisan in
crosspoint-reader#1146
* feat: Add Finnish translations by @plahteenlahti in
crosspoint-reader#1133
* feat: Add Polish Language by @th0m4sek in
crosspoint-reader#1155
* feat: add Dutch translation by @basvdploeg in
crosspoint-reader#1204
* feat: add Belarusian translation by @dexif in
crosspoint-reader#1120
* feat: Add full Italian translations by @andreaturchet in
crosspoint-reader#1144
* feat: add Ukrainian translation by @mirus-ua in
crosspoint-reader#1065
* feat: Add Kazakh (kk) language support by @fsocietyipa in
crosspoint-reader#1377
* feat: added Romanian strings by @ariel-lindemann in
crosspoint-reader#987
* feat: add Catalan strings by @angeldenom in
crosspoint-reader#1049
* feat: Make directories stand out more in local file browser: "[dir]"
instead of "dir" by @jpirnay in
crosspoint-reader#1339
* feat: Add Polish strings for commits crosspoint-reader#1219,crosspoint-reader#1169,crosspoint-reader#1031 +tweaks by
@th0m4sek in
crosspoint-reader#1227
* feat: Polish translation tweaks by @th0m4sek in
crosspoint-reader#1193
### Fixes
* fix: Fix img layout issue / support CSS display:none for elements and
images by @jpirnay in
crosspoint-reader#1443
* fix: Overlapping battery percentage on image pages with anti-aliasing
by @znelson in
crosspoint-reader#1452
* fix: Fix prewarm perf when a page contains many styles by
@adriancaruana in
crosspoint-reader#1451
* fix: use sleep routine from the original firmware by @ngxson in
crosspoint-reader#1298
* fix: Prevent line breaks on common English contractions by @znelson in
crosspoint-reader#1405
* fix: Build with -fno-exceptions by @znelson in
crosspoint-reader#1412
* fix: Reduce flash usage by cleaning up I18n translations by @steka in
crosspoint-reader#1401
* fix: jpeg resource cleanup by @jpirnay in
crosspoint-reader#1320
* fix: back button in settings returns to tab bar first by @Cache8063 in
crosspoint-reader#1354
* fix: Init lastSleepImage (edge case) by @jpirnay in
crosspoint-reader#1360
* fix: Add special handling for apostrophe hyphenation by @jpirnay in
crosspoint-reader#1318
* fix: Fix inter-word spacing rounding error in text layout by @znelson
in crosspoint-reader#1311
* fix: load access fault crash by @Uri-Tauber in
crosspoint-reader#1370
* fix: Fix bootloop logging crash by @jpirnay in
crosspoint-reader#1357
* fix: dump crash log without usb plugged, bump release log to INFO by
@ngxson in
crosspoint-reader#1332
* fix: avoid zip filename overflow by @jpirnay in
crosspoint-reader#1321
* fix: Hanging indent (negative text-indent) and em-unit sizing by
@jpirnay in
crosspoint-reader#1229
* fix: Use fixed-point fractional x-advance and kerning for better text
layout by @znelson in
crosspoint-reader#1168
* fix: use HTTPClient::writeToStream for downloading files from OPDS by
@osteotek in
crosspoint-reader#1207
* fix: make file system operations thread-safe (HalFile) by @ngxson in
crosspoint-reader#1212
* fix: properly implement requestUpdateAndWait() by @ngxson in
crosspoint-reader#1218
* fix: prevent infinite render loop in Calibre Wireless after file
transfer by @pablohc in
crosspoint-reader#1070
* fix: WiFi lifecycle and hyphenation heap defragmentation for KOReader
sync by @jpirnay in
crosspoint-reader#1151
* fix: Fix coverRendered flag by @jpirnay in
crosspoint-reader#1154
* fix: Handle non-ASCII characters in sanitizeFilename by @znelson in
crosspoint-reader#1132
* fix: Update activity was missing "Back" button label by @znelson in
crosspoint-reader#1128
* fix: force auto-hinting for Bookerly to fix inconsistent stem widths
by @adriancaruana in
crosspoint-reader#1098
* fix: image centering bleed by @martinbrook in
crosspoint-reader#1096
* fix: double free WebDAVHandler by @ngxson in
crosspoint-reader#1093
* fix: Consider extra quotation styles when hyphenating quoted words by
@cbix in
crosspoint-reader#1077
* fix: acquire power lock before sleeping by @ngxson in
crosspoint-reader#1125
* fix: Unify inconsistent Wi-Fi/WiFi in Czech translation by @pepastach
in crosspoint-reader#1138
* fix: sdfat warning about redefinition of macro by @ngxson in
crosspoint-reader#1135
* fix: Close leaked file descriptors in SleepActivity and web server by
@brbla in
crosspoint-reader#869
* fix: Enable DESTRUCTOR_CLOSES_FILE flag by @daveallie in
crosspoint-reader#1075
* fix: Change "UI Font Size" to "Reader Font Size" by @divinitycove in
crosspoint-reader#1171
* fix: Hide unusable button hints when viewing empty directory by @Levrk
in crosspoint-reader#1253
* fix: broken translations in status bar settings by @ariel-lindemann in
crosspoint-reader#1188
* fix: clarity issue with ambiguous string `SET` by @ariel-lindemann in
crosspoint-reader#1169
* fix: Crash (Load access fault) when indexing chapters containing
characters unsupported by bold/italic font variants by @Uri-Tauber in
crosspoint-reader#997
* fix: Increase PNGdec buffer size to support wide images by @osteotek
in crosspoint-reader#995
* fix: Use HalPowerManager for battery percentage by @vjapolitzer in
crosspoint-reader#1005
* fix: Fix dangling pointer by @Uri-Tauber in
crosspoint-reader#1010
* fix: re-implementing Cover Outlines for the new Lyra Themes by @Levrk
in crosspoint-reader#1017
* fix: use double FAST_REFRESH to prevent washout on large grey images
by @martinbrook in
crosspoint-reader#957
* fix: Fixed Image Sizing When No Width is Set by @DestinySpeaker in
crosspoint-reader#1002
* fix: Strip unused CSS rules by @daveallie in
crosspoint-reader#1014
* fix: continue reading card classic theme by @pablohc in
crosspoint-reader#990
* fix: Destroy CSS Cache file when invalid by @daveallie in
crosspoint-reader#1018
* fix: Shorten "Forget Wifi" button labels to fit on button by
@lukestein in
crosspoint-reader#1045
* fix: improve Spanish translations by @pablohc in
crosspoint-reader#1054
* fix: Fixed book title in home screen by @DestinySpeaker in
crosspoint-reader#1013
* fix: Fix hyphenation and rendering of decomposed characters by
@jpirnay in
crosspoint-reader#1037
* fix: Improve and add Spanish translations by @DaniPhii in
crosspoint-reader#1338
* fix: improve and add Spanish translations by @DaniPhii in
crosspoint-reader#1254
* fix: improve and add Swedish translations by @steka in
crosspoint-reader#1317
* fix: Extend missing / amend existing German translations by @jpirnay
in crosspoint-reader#1226
* fix: update french.yaml file to have a better French translation of
the CFW by @Spigaw in
crosspoint-reader#1130
* fix: added romanian translation to new strings by @ariel-lindemann in
crosspoint-reader#1105
* fix: add missing romanian strings by @ariel-lindemann in
crosspoint-reader#1187
* fix: add new Ukrainian translation line for STR_SCREENSHOT_BUTTON by
@mirus-ua in
crosspoint-reader#1149
* fix: Dutch translation prefix correction by @basvdploeg in
crosspoint-reader#1223
* fix: Small typo in i18n.md regarding C++ identifiers by
@victordomingos in
crosspoint-reader#1210
* fix: typo in USER_GUIDE.md by @arnaugamez in
crosspoint-reader#1036
* fix: add missing keyboard metrics to Lyra3CoversTheme by @dexif in
crosspoint-reader#1101

### Internal
* perf: font-compression improvements by @adriancaruana in
crosspoint-reader#1056
* perf: Improve font drawing performance by @jpirnay in
crosspoint-reader#978
* perf: Replace std::list with std::vector in text layout by @znelson in
crosspoint-reader#1038
* perf: Optimize HTML entities lookup to O(log(n)) by @Uri-Tauber in
crosspoint-reader#1194
* perf: UITheme::getMetrics const and const-ref usage by @znelson in
crosspoint-reader#1094
* perf: Avoid creating strings for file extension checks by @znelson in
crosspoint-reader#1303
* perf: Eliminate per-pixel overheads in image rendering by @martinbrook
in crosspoint-reader#1293
* perf: Update github actions for optimal performance with pioarduino by
@Jason2866 in
crosspoint-reader#1080
* style: Phase 1 - Simple light dark themes by @cdmoro in
crosspoint-reader#1006
* refactor: implement ActivityManager by @ngxson in
crosspoint-reader#1016
* refactor: Simplify REPLACEMENT_GLYPH fallback by @znelson in
crosspoint-reader#1119
* refactor: Simplify new setting introduction by @jpirnay in
crosspoint-reader#1086
* refactor: Use std binary search algorithms for font lookups by
@znelson in
crosspoint-reader#1202
* refactor: rename MyLibrary to FileBrowser by @osteotek in
crosspoint-reader#1260
* refactor: Avoid rebuilding cache path strings by @znelson in
crosspoint-reader#1300
* refactor: reader utils by @Uri-Tauber in
crosspoint-reader#1329
* chore: Remove miniz and modularise inflation logic by @daveallie in
crosspoint-reader#1073
* chore: Resolve several build warnings by @daveallie in
crosspoint-reader#1076
* chore: Removed generated language headers by @znelson in
crosspoint-reader#1156
* chore: Added generated lang headers to .gitignore by @znelson in
crosspoint-reader#1158
* chore: remove redundant xTaskCreate by @ngxson in
crosspoint-reader#1264
* chore: Removed unused PlatformIO include directory placeholder by
@znelson in
crosspoint-reader#1417
* chore: micro-optimisation: early exit on fillUncompressedSizes by
@jpirnay in
crosspoint-reader#1322
* chore: change label while on settings tab actions by @jpirnay in
crosspoint-reader#1325
* chore: add firmware size history script by @znelson in
crosspoint-reader#1235
* chore: Add powershell script for clang-formatting by @jpirnay in
crosspoint-reader#1472
* chore: Removed unused ConfirmationActivity member by @znelson in
crosspoint-reader#1234
* chore: Update russian.yaml by @madebyKir in
crosspoint-reader#1198
* chore: new Ukrainian translation lines by @mirus-ua in
crosspoint-reader#1199
* chore: new Ukrainian localization strings by @mirus-ua in
crosspoint-reader#1270
* chore: Polish localization for STR_DELETE by @JonaszPotoniec in
crosspoint-reader#1323
* chore: Image settings Polish localization by @znelson in
crosspoint-reader#1299
* chore: add missing Catalan strings by @angeldenom in
crosspoint-reader#1302
* chore: add missing translations for Romanian by @ariel-lindemann in
crosspoint-reader#1265
* chore: Add Portuguese (Portugal) translator to the list by
@victordomingos in
crosspoint-reader#1211
* chore: Reduce flash usage by cleaning up I18n translations by @steka
in crosspoint-reader#1401
* docs: Add lightweight contributor onboarding documentation by @bilalix
in crosspoint-reader#894
* docs: ActivityManager migration guide by @znelson in
crosspoint-reader#1222
* docs: USER_GUIDE.md update for 1.1.0 by @divinitycove in
crosspoint-reader#1108
* docs: add quick KOReader sync setup guide by @wjhrdy in
crosspoint-reader#1181
* docs: image support marked as completed by @ariel-lindemann in
crosspoint-reader#1008
* feat: aiagent context definition by @jpirnay in
crosspoint-reader#922
* chore: Update SKILL.md to reflect generated i18n files are gitignored
by @znelson in
crosspoint-reader#1423
* fix: ActivityManager tweaks by @znelson in
crosspoint-reader#1220
* fix: Correct relative file paths in SKILL.md documentation by @pablohc
in crosspoint-reader#1304
* fix: add Technically Unsupported section to SCOPE.md by @Uri-Tauber in
crosspoint-reader#1295

## New Contributors
* @DestinySpeaker made their first contribution in
crosspoint-reader#1002
* @arnaugamez made their first contribution in
crosspoint-reader#1036
* @angeldenom made their first contribution in
crosspoint-reader#1049
* @cdmoro made their first contribution in
crosspoint-reader#1006
* @bilalix made their first contribution in
crosspoint-reader#894
* @Jessica765 made their first contribution in
crosspoint-reader#682
* @brbla made their first contribution in
crosspoint-reader#869
* @dexif made their first contribution in
crosspoint-reader#1047
* @mirus-ua made their first contribution in
crosspoint-reader#1065
* @cbix made their first contribution in
crosspoint-reader#1077
* @divinitycove made their first contribution in
crosspoint-reader#1108
* @pepastach made their first contribution in
crosspoint-reader#1138
* @Jason2866 made their first contribution in
crosspoint-reader#1080
* @andreaturchet made their first contribution in
crosspoint-reader#1144
* @Spigaw made their first contribution in
crosspoint-reader#1130
* @iandchasse made their first contribution in
crosspoint-reader#1141
* @th0m4sek made their first contribution in
crosspoint-reader#1155
* @plahteenlahti made their first contribution in
crosspoint-reader#1133
* @hajisan made their first contribution in
crosspoint-reader#1146
* @madebyKir made their first contribution in
crosspoint-reader#1198
* @victordomingos made their first contribution in
crosspoint-reader#1210
* @basvdploeg made their first contribution in
crosspoint-reader#1204
* @wjhrdy made their first contribution in
crosspoint-reader#1181
* @DaniPhii made their first contribution in
crosspoint-reader#1254
* @steka made their first contribution in
crosspoint-reader#1317
* @barbarhan made their first contribution in
crosspoint-reader#1192
* @JonaszPotoniec made their first contribution in
crosspoint-reader#1323
* @Cache8063 made their first contribution in
crosspoint-reader#1354
* @fsocietyipa made their first contribution in
crosspoint-reader#1377
* @LSTAR1900 made their first contribution in
crosspoint-reader#979
* @zgredex made their first contribution in
crosspoint-reader#1224

**Full Changelog**:
crosspoint-reader/crosspoint-reader@1.1.1...release/1.2.0

---------

Co-authored-by: jpirnay <jens@pirnay.com>
Co-authored-by: Dani Poveda <daniphii@outlook.com>
Co-authored-by: Baris Albayrak <80099286+barbarhan@users.noreply.github.com>
Co-authored-by: Barış Albayrak <barisa@pop-os.lan>
Co-authored-by: Stefan Blixten Karlsson <sbkarlsson@gmail.com>
Co-authored-by: Àngel <153315454+angeldenom@users.noreply.github.com>
Co-authored-by: Jonasz Potoniec <jonasz@potoniec.eu>
Co-authored-by: Егор Мартынов <martynovegorOF@yandex.ru>
Co-authored-by: Mirus <mirusim@gmail.com>
Co-authored-by: Spigaw <73850535+Spigaw@users.noreply.github.com>
Co-authored-by: ariel-lindemann <41641978+ariel-lindemann@users.noreply.github.com>
Co-authored-by: Nima Salami <54304457+hajisan@users.noreply.github.com>
Co-authored-by: Arthur Tazhitdinov <lisnake@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Bas van der Ploeg <bas@basvanderploeg.nl>
Co-authored-by: martin brook <martin.brook100@googlemail.com>
bdeshi pushed a commit to bdeshi/crosspoint-reader that referenced this pull request Apr 8, 2026
## Summary

It's been a little while since the last release, but the community has
been incredibly busy. With 155 changes from 48 contributors (30 of which
were new!), there was a lot to cover. Here are some of the highlights:

**🔤 Kerning, Ligatures, and Font Improvements**
Text rendering gets a significant upgrade with proper kerning and
ligature support, fixed-point fractional x-advance for more accurate
character placement, and font compression improvements that reduce flash
usage.

**📝 Footnotes**
Footnote anchor navigation lets you select a footnote reference and jump
to the footnote text, then jump back. Slim footnotes support is also
available for books that use inline footnotes.

**📖 EPUB Optimizer**
A new integrated EPUB optimizer can clean up and reprocess books for
better compatibility with the reader, directly from the device.

**🔋 Battery Charging Indicator**
You can now see when your device is actively charging, with a visual
indicator on the battery icon.

**💾 Crash Diagnostics**
When something goes wrong, the firmware now dumps a crash report to the
SD card — even without USB plugged in. This makes it much easier to
report and diagnose issues.

**🌐 New Languages**
The community continues to expand language support. New in this release:
Turkish, Danish, Finnish, Polish, Dutch, Belarusian, Italian, Ukrainian,
Romanian, Catalan, Vietnamese, and Kazakh — along with significant
improvements to existing translations.

**📂 File Management**
Multi-select file deletion, BMP image viewer in the file browser, hidden
directory browsing, and long-click file deletion from the file browser.

**⚡ Performance**
Under the hood, text layout switched from `std::list` to `std::vector`,
HTML entity lookups are now O(log(n)), font rendering is faster, image
decode is 5-20% faster with per-pixel overhead eliminated, and multiple
string allocation hot paths were eliminated. Pre-indexing of the next
chapter also reduces page-turn latency at chapter boundaries.

---

Along with all of the above, there are many other additions including
**WebDAV support**, **auto page turn**, **QR code for current page**,
**split status bar settings**, **screenshot capture**, **JSON-based
settings migration**, **light/dark theme groundwork**, and a long list
of stability fixes and translation improvements.

## What's Changed
### Features
* feat: Support for kerning and ligatures by @znelson in
crosspoint-reader#873
* feat: footnote anchor navigation by @Uri-Tauber in
crosspoint-reader#1245
* feat: slim footnotes support by @Uri-Tauber in
crosspoint-reader#1031
* feat: integrated epub optimizer by @zgredex and @pablohc in
crosspoint-reader#1224
* feat: battery charging indicator (mirroring PR crosspoint-reader#537) by @jpirnay in
crosspoint-reader#1427
* feat: dump crash report to sdcard by @ngxson in
crosspoint-reader#1145
* feat: Implement silent pre-indexing for the next chapter in
EpubReaderActivity by @LSTAR1900 in
crosspoint-reader#979
* feat: upgrade platform and support webdav by @dexif in
crosspoint-reader#1047
* feat: Auto Page Turn for Epub Reader by @GenesiaW in
crosspoint-reader#1219
* feat: enhance file deletion functionality with multi-select by
@Jessica765 in
crosspoint-reader#682
* feat: Long Click for File Deletion through File Browser by @Levrk in
crosspoint-reader#909
* feat: Take screenshots by @el in
crosspoint-reader#759
* feat: Current page as QR by @el in
crosspoint-reader#1099
* feat: Download links for web server by @el in
crosspoint-reader#1039
* feat: Added BmpViewer activity for viewing .bmp images in file browser
by @Levrk in
crosspoint-reader#887
* feat: User setting for image display by @jpirnay in
crosspoint-reader#1291
* feat: Show hidden directories in browser by @jpirnay in
crosspoint-reader#1288
* feat: Prefer ".sleep" over "sleep" for custom image directory by
@jpirnay in
crosspoint-reader#948
* feat: Allow a local configuration file for custom compiles by @jpirnay
in crosspoint-reader#879
* feat: Migrate binary settings to json by @jpirnay in
crosspoint-reader#920
* feat: split status bar setting by @whyte-j in
crosspoint-reader#733
* feat: wrapped text in GfxRender, implemented in themes so far by
@iandchasse in
crosspoint-reader#1141
* feat: Themed language screen by @CaptainFrito in
crosspoint-reader#1020
* feat: set WiFi hostname to CrossPoint-Reader-XXXXXXXXXXXX by @dexif in
crosspoint-reader#1107
* feat: Add maxAlloc to memory information by @jpirnay in
crosspoint-reader#1152
* feat: replace picojpeg with JPEGDEC for JPEG image decoding by
@martinbrook in
crosspoint-reader#1136
* feat: Add git branch to version information on settings screen by
@jpirnay in
crosspoint-reader#1225
* feat: sort languages in selection menu by @ariel-lindemann in
crosspoint-reader#1071
* feat: Latin Extended-B European glyphs by @znelson in
crosspoint-reader#1157
* feat: Latin Extended-B European glyphs by @znelson in
crosspoint-reader#1167
* feat: Vietnamese glyphs support by @danoooob in
crosspoint-reader#1147
* feat: add Turkish translation by @barbarhan in
crosspoint-reader#1192
* feat: add full Danish translation by @hajisan in
crosspoint-reader#1146
* feat: Add Finnish translations by @plahteenlahti in
crosspoint-reader#1133
* feat: Add Polish Language by @th0m4sek in
crosspoint-reader#1155
* feat: add Dutch translation by @basvdploeg in
crosspoint-reader#1204
* feat: add Belarusian translation by @dexif in
crosspoint-reader#1120
* feat: Add full Italian translations by @andreaturchet in
crosspoint-reader#1144
* feat: add Ukrainian translation by @mirus-ua in
crosspoint-reader#1065
* feat: Add Kazakh (kk) language support by @fsocietyipa in
crosspoint-reader#1377
* feat: added Romanian strings by @ariel-lindemann in
crosspoint-reader#987
* feat: add Catalan strings by @angeldenom in
crosspoint-reader#1049
* feat: Make directories stand out more in local file browser: "[dir]"
instead of "dir" by @jpirnay in
crosspoint-reader#1339
* feat: Add Polish strings for commits crosspoint-reader#1219,crosspoint-reader#1169,crosspoint-reader#1031 +tweaks by
@th0m4sek in
crosspoint-reader#1227
* feat: Polish translation tweaks by @th0m4sek in
crosspoint-reader#1193
### Fixes
* fix: Fix img layout issue / support CSS display:none for elements and
images by @jpirnay in
crosspoint-reader#1443
* fix: Overlapping battery percentage on image pages with anti-aliasing
by @znelson in
crosspoint-reader#1452
* fix: Fix prewarm perf when a page contains many styles by
@adriancaruana in
crosspoint-reader#1451
* fix: use sleep routine from the original firmware by @ngxson in
crosspoint-reader#1298
* fix: Prevent line breaks on common English contractions by @znelson in
crosspoint-reader#1405
* fix: Build with -fno-exceptions by @znelson in
crosspoint-reader#1412
* fix: Reduce flash usage by cleaning up I18n translations by @steka in
crosspoint-reader#1401
* fix: jpeg resource cleanup by @jpirnay in
crosspoint-reader#1320
* fix: back button in settings returns to tab bar first by @Cache8063 in
crosspoint-reader#1354
* fix: Init lastSleepImage (edge case) by @jpirnay in
crosspoint-reader#1360
* fix: Add special handling for apostrophe hyphenation by @jpirnay in
crosspoint-reader#1318
* fix: Fix inter-word spacing rounding error in text layout by @znelson
in crosspoint-reader#1311
* fix: load access fault crash by @Uri-Tauber in
crosspoint-reader#1370
* fix: Fix bootloop logging crash by @jpirnay in
crosspoint-reader#1357
* fix: dump crash log without usb plugged, bump release log to INFO by
@ngxson in
crosspoint-reader#1332
* fix: avoid zip filename overflow by @jpirnay in
crosspoint-reader#1321
* fix: Hanging indent (negative text-indent) and em-unit sizing by
@jpirnay in
crosspoint-reader#1229
* fix: Use fixed-point fractional x-advance and kerning for better text
layout by @znelson in
crosspoint-reader#1168
* fix: use HTTPClient::writeToStream for downloading files from OPDS by
@osteotek in
crosspoint-reader#1207
* fix: make file system operations thread-safe (HalFile) by @ngxson in
crosspoint-reader#1212
* fix: properly implement requestUpdateAndWait() by @ngxson in
crosspoint-reader#1218
* fix: prevent infinite render loop in Calibre Wireless after file
transfer by @pablohc in
crosspoint-reader#1070
* fix: WiFi lifecycle and hyphenation heap defragmentation for KOReader
sync by @jpirnay in
crosspoint-reader#1151
* fix: Fix coverRendered flag by @jpirnay in
crosspoint-reader#1154
* fix: Handle non-ASCII characters in sanitizeFilename by @znelson in
crosspoint-reader#1132
* fix: Update activity was missing "Back" button label by @znelson in
crosspoint-reader#1128
* fix: force auto-hinting for Bookerly to fix inconsistent stem widths
by @adriancaruana in
crosspoint-reader#1098
* fix: image centering bleed by @martinbrook in
crosspoint-reader#1096
* fix: double free WebDAVHandler by @ngxson in
crosspoint-reader#1093
* fix: Consider extra quotation styles when hyphenating quoted words by
@cbix in
crosspoint-reader#1077
* fix: acquire power lock before sleeping by @ngxson in
crosspoint-reader#1125
* fix: Unify inconsistent Wi-Fi/WiFi in Czech translation by @pepastach
in crosspoint-reader#1138
* fix: sdfat warning about redefinition of macro by @ngxson in
crosspoint-reader#1135
* fix: Close leaked file descriptors in SleepActivity and web server by
@brbla in
crosspoint-reader#869
* fix: Enable DESTRUCTOR_CLOSES_FILE flag by @daveallie in
crosspoint-reader#1075
* fix: Change "UI Font Size" to "Reader Font Size" by @divinitycove in
crosspoint-reader#1171
* fix: Hide unusable button hints when viewing empty directory by @Levrk
in crosspoint-reader#1253
* fix: broken translations in status bar settings by @ariel-lindemann in
crosspoint-reader#1188
* fix: clarity issue with ambiguous string `SET` by @ariel-lindemann in
crosspoint-reader#1169
* fix: Crash (Load access fault) when indexing chapters containing
characters unsupported by bold/italic font variants by @Uri-Tauber in
crosspoint-reader#997
* fix: Increase PNGdec buffer size to support wide images by @osteotek
in crosspoint-reader#995
* fix: Use HalPowerManager for battery percentage by @vjapolitzer in
crosspoint-reader#1005
* fix: Fix dangling pointer by @Uri-Tauber in
crosspoint-reader#1010
* fix: re-implementing Cover Outlines for the new Lyra Themes by @Levrk
in crosspoint-reader#1017
* fix: use double FAST_REFRESH to prevent washout on large grey images
by @martinbrook in
crosspoint-reader#957
* fix: Fixed Image Sizing When No Width is Set by @DestinySpeaker in
crosspoint-reader#1002
* fix: Strip unused CSS rules by @daveallie in
crosspoint-reader#1014
* fix: continue reading card classic theme by @pablohc in
crosspoint-reader#990
* fix: Destroy CSS Cache file when invalid by @daveallie in
crosspoint-reader#1018
* fix: Shorten "Forget Wifi" button labels to fit on button by
@lukestein in
crosspoint-reader#1045
* fix: improve Spanish translations by @pablohc in
crosspoint-reader#1054
* fix: Fixed book title in home screen by @DestinySpeaker in
crosspoint-reader#1013
* fix: Fix hyphenation and rendering of decomposed characters by
@jpirnay in
crosspoint-reader#1037
* fix: Improve and add Spanish translations by @DaniPhii in
crosspoint-reader#1338
* fix: improve and add Spanish translations by @DaniPhii in
crosspoint-reader#1254
* fix: improve and add Swedish translations by @steka in
crosspoint-reader#1317
* fix: Extend missing / amend existing German translations by @jpirnay
in crosspoint-reader#1226
* fix: update french.yaml file to have a better French translation of
the CFW by @Spigaw in
crosspoint-reader#1130
* fix: added romanian translation to new strings by @ariel-lindemann in
crosspoint-reader#1105
* fix: add missing romanian strings by @ariel-lindemann in
crosspoint-reader#1187
* fix: add new Ukrainian translation line for STR_SCREENSHOT_BUTTON by
@mirus-ua in
crosspoint-reader#1149
* fix: Dutch translation prefix correction by @basvdploeg in
crosspoint-reader#1223
* fix: Small typo in i18n.md regarding C++ identifiers by
@victordomingos in
crosspoint-reader#1210
* fix: typo in USER_GUIDE.md by @arnaugamez in
crosspoint-reader#1036
* fix: add missing keyboard metrics to Lyra3CoversTheme by @dexif in
crosspoint-reader#1101

### Internal
* perf: font-compression improvements by @adriancaruana in
crosspoint-reader#1056
* perf: Improve font drawing performance by @jpirnay in
crosspoint-reader#978
* perf: Replace std::list with std::vector in text layout by @znelson in
crosspoint-reader#1038
* perf: Optimize HTML entities lookup to O(log(n)) by @Uri-Tauber in
crosspoint-reader#1194
* perf: UITheme::getMetrics const and const-ref usage by @znelson in
crosspoint-reader#1094
* perf: Avoid creating strings for file extension checks by @znelson in
crosspoint-reader#1303
* perf: Eliminate per-pixel overheads in image rendering by @martinbrook
in crosspoint-reader#1293
* perf: Update github actions for optimal performance with pioarduino by
@Jason2866 in
crosspoint-reader#1080
* style: Phase 1 - Simple light dark themes by @cdmoro in
crosspoint-reader#1006
* refactor: implement ActivityManager by @ngxson in
crosspoint-reader#1016
* refactor: Simplify REPLACEMENT_GLYPH fallback by @znelson in
crosspoint-reader#1119
* refactor: Simplify new setting introduction by @jpirnay in
crosspoint-reader#1086
* refactor: Use std binary search algorithms for font lookups by
@znelson in
crosspoint-reader#1202
* refactor: rename MyLibrary to FileBrowser by @osteotek in
crosspoint-reader#1260
* refactor: Avoid rebuilding cache path strings by @znelson in
crosspoint-reader#1300
* refactor: reader utils by @Uri-Tauber in
crosspoint-reader#1329
* chore: Remove miniz and modularise inflation logic by @daveallie in
crosspoint-reader#1073
* chore: Resolve several build warnings by @daveallie in
crosspoint-reader#1076
* chore: Removed generated language headers by @znelson in
crosspoint-reader#1156
* chore: Added generated lang headers to .gitignore by @znelson in
crosspoint-reader#1158
* chore: remove redundant xTaskCreate by @ngxson in
crosspoint-reader#1264
* chore: Removed unused PlatformIO include directory placeholder by
@znelson in
crosspoint-reader#1417
* chore: micro-optimisation: early exit on fillUncompressedSizes by
@jpirnay in
crosspoint-reader#1322
* chore: change label while on settings tab actions by @jpirnay in
crosspoint-reader#1325
* chore: add firmware size history script by @znelson in
crosspoint-reader#1235
* chore: Add powershell script for clang-formatting by @jpirnay in
crosspoint-reader#1472
* chore: Removed unused ConfirmationActivity member by @znelson in
crosspoint-reader#1234
* chore: Update russian.yaml by @madebyKir in
crosspoint-reader#1198
* chore: new Ukrainian translation lines by @mirus-ua in
crosspoint-reader#1199
* chore: new Ukrainian localization strings by @mirus-ua in
crosspoint-reader#1270
* chore: Polish localization for STR_DELETE by @JonaszPotoniec in
crosspoint-reader#1323
* chore: Image settings Polish localization by @znelson in
crosspoint-reader#1299
* chore: add missing Catalan strings by @angeldenom in
crosspoint-reader#1302
* chore: add missing translations for Romanian by @ariel-lindemann in
crosspoint-reader#1265
* chore: Add Portuguese (Portugal) translator to the list by
@victordomingos in
crosspoint-reader#1211
* chore: Reduce flash usage by cleaning up I18n translations by @steka
in crosspoint-reader#1401
* docs: Add lightweight contributor onboarding documentation by @bilalix
in crosspoint-reader#894
* docs: ActivityManager migration guide by @znelson in
crosspoint-reader#1222
* docs: USER_GUIDE.md update for 1.1.0 by @divinitycove in
crosspoint-reader#1108
* docs: add quick KOReader sync setup guide by @wjhrdy in
crosspoint-reader#1181
* docs: image support marked as completed by @ariel-lindemann in
crosspoint-reader#1008
* feat: aiagent context definition by @jpirnay in
crosspoint-reader#922
* chore: Update SKILL.md to reflect generated i18n files are gitignored
by @znelson in
crosspoint-reader#1423
* fix: ActivityManager tweaks by @znelson in
crosspoint-reader#1220
* fix: Correct relative file paths in SKILL.md documentation by @pablohc
in crosspoint-reader#1304
* fix: add Technically Unsupported section to SCOPE.md by @Uri-Tauber in
crosspoint-reader#1295

## New Contributors
* @DestinySpeaker made their first contribution in
crosspoint-reader#1002
* @arnaugamez made their first contribution in
crosspoint-reader#1036
* @angeldenom made their first contribution in
crosspoint-reader#1049
* @cdmoro made their first contribution in
crosspoint-reader#1006
* @bilalix made their first contribution in
crosspoint-reader#894
* @Jessica765 made their first contribution in
crosspoint-reader#682
* @brbla made their first contribution in
crosspoint-reader#869
* @dexif made their first contribution in
crosspoint-reader#1047
* @mirus-ua made their first contribution in
crosspoint-reader#1065
* @cbix made their first contribution in
crosspoint-reader#1077
* @divinitycove made their first contribution in
crosspoint-reader#1108
* @pepastach made their first contribution in
crosspoint-reader#1138
* @Jason2866 made their first contribution in
crosspoint-reader#1080
* @andreaturchet made their first contribution in
crosspoint-reader#1144
* @Spigaw made their first contribution in
crosspoint-reader#1130
* @iandchasse made their first contribution in
crosspoint-reader#1141
* @th0m4sek made their first contribution in
crosspoint-reader#1155
* @plahteenlahti made their first contribution in
crosspoint-reader#1133
* @hajisan made their first contribution in
crosspoint-reader#1146
* @madebyKir made their first contribution in
crosspoint-reader#1198
* @victordomingos made their first contribution in
crosspoint-reader#1210
* @basvdploeg made their first contribution in
crosspoint-reader#1204
* @wjhrdy made their first contribution in
crosspoint-reader#1181
* @DaniPhii made their first contribution in
crosspoint-reader#1254
* @steka made their first contribution in
crosspoint-reader#1317
* @barbarhan made their first contribution in
crosspoint-reader#1192
* @JonaszPotoniec made their first contribution in
crosspoint-reader#1323
* @Cache8063 made their first contribution in
crosspoint-reader#1354
* @fsocietyipa made their first contribution in
crosspoint-reader#1377
* @LSTAR1900 made their first contribution in
crosspoint-reader#979
* @zgredex made their first contribution in
crosspoint-reader#1224

**Full Changelog**:
crosspoint-reader/crosspoint-reader@1.1.1...release/1.2.0

---------

Co-authored-by: jpirnay <jens@pirnay.com>
Co-authored-by: Dani Poveda <daniphii@outlook.com>
Co-authored-by: Baris Albayrak <80099286+barbarhan@users.noreply.github.com>
Co-authored-by: Barış Albayrak <barisa@pop-os.lan>
Co-authored-by: Stefan Blixten Karlsson <sbkarlsson@gmail.com>
Co-authored-by: Àngel <153315454+angeldenom@users.noreply.github.com>
Co-authored-by: Jonasz Potoniec <jonasz@potoniec.eu>
Co-authored-by: Егор Мартынов <martynovegorOF@yandex.ru>
Co-authored-by: Mirus <mirusim@gmail.com>
Co-authored-by: Spigaw <73850535+Spigaw@users.noreply.github.com>
Co-authored-by: ariel-lindemann <41641978+ariel-lindemann@users.noreply.github.com>
Co-authored-by: Nima Salami <54304457+hajisan@users.noreply.github.com>
Co-authored-by: Arthur Tazhitdinov <lisnake@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Bas van der Ploeg <bas@basvanderploeg.nl>
Co-authored-by: martin brook <martin.brook100@googlemail.com>
aBER0724 pushed a commit to aBER0724/crosspoint-reader-cjk that referenced this pull request May 7, 2026
…1298)

## Summary

Fixes crosspoint-reader#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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/6d53ce44-7bae-40c7-b4fb-24f898dbcc05">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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/b98d59fd-47ca-4d3d-a24a-94bf999e957b">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="/deoxy?target=https%3A%2F%2Fgithub.com%2Fcrosspoint-reader%2Fcrosspoint-reader%2Fpull%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/2981c411-239b-49a7-b9f7-9a75b6c1b6d3">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
crosspoint-reader#1298 (comment)
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>
aBER0724 pushed a commit to aBER0724/crosspoint-reader-cjk that referenced this pull request May 7, 2026
## Summary

It's been a little while since the last release, but the community has
been incredibly busy. With 155 changes from 48 contributors (30 of which
were new!), there was a lot to cover. Here are some of the highlights:

**🔤 Kerning, Ligatures, and Font Improvements**
Text rendering gets a significant upgrade with proper kerning and
ligature support, fixed-point fractional x-advance for more accurate
character placement, and font compression improvements that reduce flash
usage.

**📝 Footnotes**
Footnote anchor navigation lets you select a footnote reference and jump
to the footnote text, then jump back. Slim footnotes support is also
available for books that use inline footnotes.

**📖 EPUB Optimizer**
A new integrated EPUB optimizer can clean up and reprocess books for
better compatibility with the reader, directly from the device.

**🔋 Battery Charging Indicator**
You can now see when your device is actively charging, with a visual
indicator on the battery icon.

**💾 Crash Diagnostics**
When something goes wrong, the firmware now dumps a crash report to the
SD card — even without USB plugged in. This makes it much easier to
report and diagnose issues.

**🌐 New Languages**
The community continues to expand language support. New in this release:
Turkish, Danish, Finnish, Polish, Dutch, Belarusian, Italian, Ukrainian,
Romanian, Catalan, Vietnamese, and Kazakh — along with significant
improvements to existing translations.

**📂 File Management**
Multi-select file deletion, BMP image viewer in the file browser, hidden
directory browsing, and long-click file deletion from the file browser.

**⚡ Performance**
Under the hood, text layout switched from `std::list` to `std::vector`,
HTML entity lookups are now O(log(n)), font rendering is faster, image
decode is 5-20% faster with per-pixel overhead eliminated, and multiple
string allocation hot paths were eliminated. Pre-indexing of the next
chapter also reduces page-turn latency at chapter boundaries.

---

Along with all of the above, there are many other additions including
**WebDAV support**, **auto page turn**, **QR code for current page**,
**split status bar settings**, **screenshot capture**, **JSON-based
settings migration**, **light/dark theme groundwork**, and a long list
of stability fixes and translation improvements.

## What's Changed
### Features
* feat: Support for kerning and ligatures by @znelson in
crosspoint-reader#873
* feat: footnote anchor navigation by @Uri-Tauber in
crosspoint-reader#1245
* feat: slim footnotes support by @Uri-Tauber in
crosspoint-reader#1031
* feat: integrated epub optimizer by @zgredex and @pablohc in
crosspoint-reader#1224
* feat: battery charging indicator (mirroring PR crosspoint-reader#537) by @jpirnay in
crosspoint-reader#1427
* feat: dump crash report to sdcard by @ngxson in
crosspoint-reader#1145
* feat: Implement silent pre-indexing for the next chapter in
EpubReaderActivity by @LSTAR1900 in
crosspoint-reader#979
* feat: upgrade platform and support webdav by @dexif in
crosspoint-reader#1047
* feat: Auto Page Turn for Epub Reader by @GenesiaW in
crosspoint-reader#1219
* feat: enhance file deletion functionality with multi-select by
@Jessica765 in
crosspoint-reader#682
* feat: Long Click for File Deletion through File Browser by @Levrk in
crosspoint-reader#909
* feat: Take screenshots by @el in
crosspoint-reader#759
* feat: Current page as QR by @el in
crosspoint-reader#1099
* feat: Download links for web server by @el in
crosspoint-reader#1039
* feat: Added BmpViewer activity for viewing .bmp images in file browser
by @Levrk in
crosspoint-reader#887
* feat: User setting for image display by @jpirnay in
crosspoint-reader#1291
* feat: Show hidden directories in browser by @jpirnay in
crosspoint-reader#1288
* feat: Prefer ".sleep" over "sleep" for custom image directory by
@jpirnay in
crosspoint-reader#948
* feat: Allow a local configuration file for custom compiles by @jpirnay
in crosspoint-reader#879
* feat: Migrate binary settings to json by @jpirnay in
crosspoint-reader#920
* feat: split status bar setting by @whyte-j in
crosspoint-reader#733
* feat: wrapped text in GfxRender, implemented in themes so far by
@iandchasse in
crosspoint-reader#1141
* feat: Themed language screen by @CaptainFrito in
crosspoint-reader#1020
* feat: set WiFi hostname to CrossPoint-Reader-XXXXXXXXXXXX by @dexif in
crosspoint-reader#1107
* feat: Add maxAlloc to memory information by @jpirnay in
crosspoint-reader#1152
* feat: replace picojpeg with JPEGDEC for JPEG image decoding by
@martinbrook in
crosspoint-reader#1136
* feat: Add git branch to version information on settings screen by
@jpirnay in
crosspoint-reader#1225
* feat: sort languages in selection menu by @ariel-lindemann in
crosspoint-reader#1071
* feat: Latin Extended-B European glyphs by @znelson in
crosspoint-reader#1157
* feat: Latin Extended-B European glyphs by @znelson in
crosspoint-reader#1167
* feat: Vietnamese glyphs support by @danoooob in
crosspoint-reader#1147
* feat: add Turkish translation by @barbarhan in
crosspoint-reader#1192
* feat: add full Danish translation by @hajisan in
crosspoint-reader#1146
* feat: Add Finnish translations by @plahteenlahti in
crosspoint-reader#1133
* feat: Add Polish Language by @th0m4sek in
crosspoint-reader#1155
* feat: add Dutch translation by @basvdploeg in
crosspoint-reader#1204
* feat: add Belarusian translation by @dexif in
crosspoint-reader#1120
* feat: Add full Italian translations by @andreaturchet in
crosspoint-reader#1144
* feat: add Ukrainian translation by @mirus-ua in
crosspoint-reader#1065
* feat: Add Kazakh (kk) language support by @fsocietyipa in
crosspoint-reader#1377
* feat: added Romanian strings by @ariel-lindemann in
crosspoint-reader#987
* feat: add Catalan strings by @angeldenom in
crosspoint-reader#1049
* feat: Make directories stand out more in local file browser: "[dir]"
instead of "dir" by @jpirnay in
crosspoint-reader#1339
* feat: Add Polish strings for commits crosspoint-reader#1219,crosspoint-reader#1169,crosspoint-reader#1031 +tweaks by
@th0m4sek in
crosspoint-reader#1227
* feat: Polish translation tweaks by @th0m4sek in
crosspoint-reader#1193
### Fixes
* fix: Fix img layout issue / support CSS display:none for elements and
images by @jpirnay in
crosspoint-reader#1443
* fix: Overlapping battery percentage on image pages with anti-aliasing
by @znelson in
crosspoint-reader#1452
* fix: Fix prewarm perf when a page contains many styles by
@adriancaruana in
crosspoint-reader#1451
* fix: use sleep routine from the original firmware by @ngxson in
crosspoint-reader#1298
* fix: Prevent line breaks on common English contractions by @znelson in
crosspoint-reader#1405
* fix: Build with -fno-exceptions by @znelson in
crosspoint-reader#1412
* fix: Reduce flash usage by cleaning up I18n translations by @steka in
crosspoint-reader#1401
* fix: jpeg resource cleanup by @jpirnay in
crosspoint-reader#1320
* fix: back button in settings returns to tab bar first by @Cache8063 in
crosspoint-reader#1354
* fix: Init lastSleepImage (edge case) by @jpirnay in
crosspoint-reader#1360
* fix: Add special handling for apostrophe hyphenation by @jpirnay in
crosspoint-reader#1318
* fix: Fix inter-word spacing rounding error in text layout by @znelson
in crosspoint-reader#1311
* fix: load access fault crash by @Uri-Tauber in
crosspoint-reader#1370
* fix: Fix bootloop logging crash by @jpirnay in
crosspoint-reader#1357
* fix: dump crash log without usb plugged, bump release log to INFO by
@ngxson in
crosspoint-reader#1332
* fix: avoid zip filename overflow by @jpirnay in
crosspoint-reader#1321
* fix: Hanging indent (negative text-indent) and em-unit sizing by
@jpirnay in
crosspoint-reader#1229
* fix: Use fixed-point fractional x-advance and kerning for better text
layout by @znelson in
crosspoint-reader#1168
* fix: use HTTPClient::writeToStream for downloading files from OPDS by
@osteotek in
crosspoint-reader#1207
* fix: make file system operations thread-safe (HalFile) by @ngxson in
crosspoint-reader#1212
* fix: properly implement requestUpdateAndWait() by @ngxson in
crosspoint-reader#1218
* fix: prevent infinite render loop in Calibre Wireless after file
transfer by @pablohc in
crosspoint-reader#1070
* fix: WiFi lifecycle and hyphenation heap defragmentation for KOReader
sync by @jpirnay in
crosspoint-reader#1151
* fix: Fix coverRendered flag by @jpirnay in
crosspoint-reader#1154
* fix: Handle non-ASCII characters in sanitizeFilename by @znelson in
crosspoint-reader#1132
* fix: Update activity was missing "Back" button label by @znelson in
crosspoint-reader#1128
* fix: force auto-hinting for Bookerly to fix inconsistent stem widths
by @adriancaruana in
crosspoint-reader#1098
* fix: image centering bleed by @martinbrook in
crosspoint-reader#1096
* fix: double free WebDAVHandler by @ngxson in
crosspoint-reader#1093
* fix: Consider extra quotation styles when hyphenating quoted words by
@cbix in
crosspoint-reader#1077
* fix: acquire power lock before sleeping by @ngxson in
crosspoint-reader#1125
* fix: Unify inconsistent Wi-Fi/WiFi in Czech translation by @pepastach
in crosspoint-reader#1138
* fix: sdfat warning about redefinition of macro by @ngxson in
crosspoint-reader#1135
* fix: Close leaked file descriptors in SleepActivity and web server by
@brbla in
crosspoint-reader#869
* fix: Enable DESTRUCTOR_CLOSES_FILE flag by @daveallie in
crosspoint-reader#1075
* fix: Change "UI Font Size" to "Reader Font Size" by @divinitycove in
crosspoint-reader#1171
* fix: Hide unusable button hints when viewing empty directory by @Levrk
in crosspoint-reader#1253
* fix: broken translations in status bar settings by @ariel-lindemann in
crosspoint-reader#1188
* fix: clarity issue with ambiguous string `SET` by @ariel-lindemann in
crosspoint-reader#1169
* fix: Crash (Load access fault) when indexing chapters containing
characters unsupported by bold/italic font variants by @Uri-Tauber in
crosspoint-reader#997
* fix: Increase PNGdec buffer size to support wide images by @osteotek
in crosspoint-reader#995
* fix: Use HalPowerManager for battery percentage by @vjapolitzer in
crosspoint-reader#1005
* fix: Fix dangling pointer by @Uri-Tauber in
crosspoint-reader#1010
* fix: re-implementing Cover Outlines for the new Lyra Themes by @Levrk
in crosspoint-reader#1017
* fix: use double FAST_REFRESH to prevent washout on large grey images
by @martinbrook in
crosspoint-reader#957
* fix: Fixed Image Sizing When No Width is Set by @DestinySpeaker in
crosspoint-reader#1002
* fix: Strip unused CSS rules by @daveallie in
crosspoint-reader#1014
* fix: continue reading card classic theme by @pablohc in
crosspoint-reader#990
* fix: Destroy CSS Cache file when invalid by @daveallie in
crosspoint-reader#1018
* fix: Shorten "Forget Wifi" button labels to fit on button by
@lukestein in
crosspoint-reader#1045
* fix: improve Spanish translations by @pablohc in
crosspoint-reader#1054
* fix: Fixed book title in home screen by @DestinySpeaker in
crosspoint-reader#1013
* fix: Fix hyphenation and rendering of decomposed characters by
@jpirnay in
crosspoint-reader#1037
* fix: Improve and add Spanish translations by @DaniPhii in
crosspoint-reader#1338
* fix: improve and add Spanish translations by @DaniPhii in
crosspoint-reader#1254
* fix: improve and add Swedish translations by @steka in
crosspoint-reader#1317
* fix: Extend missing / amend existing German translations by @jpirnay
in crosspoint-reader#1226
* fix: update french.yaml file to have a better French translation of
the CFW by @Spigaw in
crosspoint-reader#1130
* fix: added romanian translation to new strings by @ariel-lindemann in
crosspoint-reader#1105
* fix: add missing romanian strings by @ariel-lindemann in
crosspoint-reader#1187
* fix: add new Ukrainian translation line for STR_SCREENSHOT_BUTTON by
@mirus-ua in
crosspoint-reader#1149
* fix: Dutch translation prefix correction by @basvdploeg in
crosspoint-reader#1223
* fix: Small typo in i18n.md regarding C++ identifiers by
@victordomingos in
crosspoint-reader#1210
* fix: typo in USER_GUIDE.md by @arnaugamez in
crosspoint-reader#1036
* fix: add missing keyboard metrics to Lyra3CoversTheme by @dexif in
crosspoint-reader#1101

### Internal
* perf: font-compression improvements by @adriancaruana in
crosspoint-reader#1056
* perf: Improve font drawing performance by @jpirnay in
crosspoint-reader#978
* perf: Replace std::list with std::vector in text layout by @znelson in
crosspoint-reader#1038
* perf: Optimize HTML entities lookup to O(log(n)) by @Uri-Tauber in
crosspoint-reader#1194
* perf: UITheme::getMetrics const and const-ref usage by @znelson in
crosspoint-reader#1094
* perf: Avoid creating strings for file extension checks by @znelson in
crosspoint-reader#1303
* perf: Eliminate per-pixel overheads in image rendering by @martinbrook
in crosspoint-reader#1293
* perf: Update github actions for optimal performance with pioarduino by
@Jason2866 in
crosspoint-reader#1080
* style: Phase 1 - Simple light dark themes by @cdmoro in
crosspoint-reader#1006
* refactor: implement ActivityManager by @ngxson in
crosspoint-reader#1016
* refactor: Simplify REPLACEMENT_GLYPH fallback by @znelson in
crosspoint-reader#1119
* refactor: Simplify new setting introduction by @jpirnay in
crosspoint-reader#1086
* refactor: Use std binary search algorithms for font lookups by
@znelson in
crosspoint-reader#1202
* refactor: rename MyLibrary to FileBrowser by @osteotek in
crosspoint-reader#1260
* refactor: Avoid rebuilding cache path strings by @znelson in
crosspoint-reader#1300
* refactor: reader utils by @Uri-Tauber in
crosspoint-reader#1329
* chore: Remove miniz and modularise inflation logic by @daveallie in
crosspoint-reader#1073
* chore: Resolve several build warnings by @daveallie in
crosspoint-reader#1076
* chore: Removed generated language headers by @znelson in
crosspoint-reader#1156
* chore: Added generated lang headers to .gitignore by @znelson in
crosspoint-reader#1158
* chore: remove redundant xTaskCreate by @ngxson in
crosspoint-reader#1264
* chore: Removed unused PlatformIO include directory placeholder by
@znelson in
crosspoint-reader#1417
* chore: micro-optimisation: early exit on fillUncompressedSizes by
@jpirnay in
crosspoint-reader#1322
* chore: change label while on settings tab actions by @jpirnay in
crosspoint-reader#1325
* chore: add firmware size history script by @znelson in
crosspoint-reader#1235
* chore: Add powershell script for clang-formatting by @jpirnay in
crosspoint-reader#1472
* chore: Removed unused ConfirmationActivity member by @znelson in
crosspoint-reader#1234
* chore: Update russian.yaml by @madebyKir in
crosspoint-reader#1198
* chore: new Ukrainian translation lines by @mirus-ua in
crosspoint-reader#1199
* chore: new Ukrainian localization strings by @mirus-ua in
crosspoint-reader#1270
* chore: Polish localization for STR_DELETE by @JonaszPotoniec in
crosspoint-reader#1323
* chore: Image settings Polish localization by @znelson in
crosspoint-reader#1299
* chore: add missing Catalan strings by @angeldenom in
crosspoint-reader#1302
* chore: add missing translations for Romanian by @ariel-lindemann in
crosspoint-reader#1265
* chore: Add Portuguese (Portugal) translator to the list by
@victordomingos in
crosspoint-reader#1211
* chore: Reduce flash usage by cleaning up I18n translations by @steka
in crosspoint-reader#1401
* docs: Add lightweight contributor onboarding documentation by @bilalix
in crosspoint-reader#894
* docs: ActivityManager migration guide by @znelson in
crosspoint-reader#1222
* docs: USER_GUIDE.md update for 1.1.0 by @divinitycove in
crosspoint-reader#1108
* docs: add quick KOReader sync setup guide by @wjhrdy in
crosspoint-reader#1181
* docs: image support marked as completed by @ariel-lindemann in
crosspoint-reader#1008
* feat: aiagent context definition by @jpirnay in
crosspoint-reader#922
* chore: Update SKILL.md to reflect generated i18n files are gitignored
by @znelson in
crosspoint-reader#1423
* fix: ActivityManager tweaks by @znelson in
crosspoint-reader#1220
* fix: Correct relative file paths in SKILL.md documentation by @pablohc
in crosspoint-reader#1304
* fix: add Technically Unsupported section to SCOPE.md by @Uri-Tauber in
crosspoint-reader#1295

## New Contributors
* @DestinySpeaker made their first contribution in
crosspoint-reader#1002
* @arnaugamez made their first contribution in
crosspoint-reader#1036
* @angeldenom made their first contribution in
crosspoint-reader#1049
* @cdmoro made their first contribution in
crosspoint-reader#1006
* @bilalix made their first contribution in
crosspoint-reader#894
* @Jessica765 made their first contribution in
crosspoint-reader#682
* @brbla made their first contribution in
crosspoint-reader#869
* @dexif made their first contribution in
crosspoint-reader#1047
* @mirus-ua made their first contribution in
crosspoint-reader#1065
* @cbix made their first contribution in
crosspoint-reader#1077
* @divinitycove made their first contribution in
crosspoint-reader#1108
* @pepastach made their first contribution in
crosspoint-reader#1138
* @Jason2866 made their first contribution in
crosspoint-reader#1080
* @andreaturchet made their first contribution in
crosspoint-reader#1144
* @Spigaw made their first contribution in
crosspoint-reader#1130
* @iandchasse made their first contribution in
crosspoint-reader#1141
* @th0m4sek made their first contribution in
crosspoint-reader#1155
* @plahteenlahti made their first contribution in
crosspoint-reader#1133
* @hajisan made their first contribution in
crosspoint-reader#1146
* @madebyKir made their first contribution in
crosspoint-reader#1198
* @victordomingos made their first contribution in
crosspoint-reader#1210
* @basvdploeg made their first contribution in
crosspoint-reader#1204
* @wjhrdy made their first contribution in
crosspoint-reader#1181
* @DaniPhii made their first contribution in
crosspoint-reader#1254
* @steka made their first contribution in
crosspoint-reader#1317
* @barbarhan made their first contribution in
crosspoint-reader#1192
* @JonaszPotoniec made their first contribution in
crosspoint-reader#1323
* @Cache8063 made their first contribution in
crosspoint-reader#1354
* @fsocietyipa made their first contribution in
crosspoint-reader#1377
* @LSTAR1900 made their first contribution in
crosspoint-reader#979
* @zgredex made their first contribution in
crosspoint-reader#1224

**Full Changelog**:
crosspoint-reader/crosspoint-reader@1.1.1...release/1.2.0

---------

Co-authored-by: jpirnay <jens@pirnay.com>
Co-authored-by: Dani Poveda <daniphii@outlook.com>
Co-authored-by: Baris Albayrak <80099286+barbarhan@users.noreply.github.com>
Co-authored-by: Barış Albayrak <barisa@pop-os.lan>
Co-authored-by: Stefan Blixten Karlsson <sbkarlsson@gmail.com>
Co-authored-by: Àngel <153315454+angeldenom@users.noreply.github.com>
Co-authored-by: Jonasz Potoniec <jonasz@potoniec.eu>
Co-authored-by: Егор Мартынов <martynovegorOF@yandex.ru>
Co-authored-by: Mirus <mirusim@gmail.com>
Co-authored-by: Spigaw <73850535+Spigaw@users.noreply.github.com>
Co-authored-by: ariel-lindemann <41641978+ariel-lindemann@users.noreply.github.com>
Co-authored-by: Nima Salami <54304457+hajisan@users.noreply.github.com>
Co-authored-by: Arthur Tazhitdinov <lisnake@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Bas van der Ploeg <bas@basvanderploeg.nl>
Co-authored-by: martin brook <martin.brook100@googlemail.com>
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.

Hang on sleep with battery drain

4 participants