Skip to content

FlexBLE 1.0.0: merge upstream CrossInk v1.2.11.1 + BLE-friendly heap budgeting - #6

Merged
imshentastic merged 281 commits into
mainfrom
merge/upstream-v1.2.11.1
May 18, 2026
Merged

FlexBLE 1.0.0: merge upstream CrossInk v1.2.11.1 + BLE-friendly heap budgeting#6
imshentastic merged 281 commits into
mainfrom
merge/upstream-v1.2.11.1

Conversation

@imshentastic

Copy link
Copy Markdown
Owner

Summary

First stable FlexBLE release with its own semver (flexble_version = 1.0.0), built on a merge of upstream CrossInk v1.2.11.1. The crossink_version field tracks the upstream sync point and stays meaningful for OTA/issue correlation; flexble_version is FlexBLE's own scheme. Boot log and Settings → System display FlexBLE 1.0.0 (CrossInk 1.2.11.1).

Headline FlexBLE-specific changes

BLE quality-of-life

  • BT Quick Connect action in the Global Book Settings drawer. From inside a book, long-press menu → BT Quick Connect → enables BLE and reconnects to the bonded remote (or launches the pair UI if none), closes drawer back to the book on success.
  • After a successful BLE connect from inside a book, both the BT settings activity and the reader menu auto-pop so the user lands straight back in the book — no manual back-tapping.
  • Bluetooth main menu uses Up/Down labels and binds both side U/D and front L/R to navigation, matching Reader Options / Controls Options.
  • BluetoothSettings Confirm action handlers switched from wasPressed to wasReleased so the release doesn't leak through to the underlying reader menu on pop (was causing re-launch loops).
  • Back release suppressed after long-blocking BLE reconnects so an impatient Back tap during the 2-3 s freeze doesn't cascade into a reader exit + BLE auto-disable.

Grayscale + memory

  • PackBits-compressed BW backup for the grayscale anti-aliasing pass. Single bounded allocation (max 32 KB) instead of 12 × 4 KB chunks; typical reader pages compress 10-30×. Dramatically reduces fragmentation failures when BLE is consuming its ~58 KB.
  • Auto-retry on chapter-layout abort: if the parser trips the heap floor while BLE is active, FlexBLE silently disables BLE, retries the parse with freed headroom, and lets the existing auto-reconnect logic re-establish the link on the next remote button press.
  • Heap thresholds tuned for BLE-paired sessions: text-layout floor 48→16 KB free, image-extraction floor 72→56 KB free. Failures still degrade gracefully (image extraction → page without images; layout abort → BLE-disable-retry path).

Theme preservation through the merge

  • LyraFlowTheme (5-book carousel from chintanvajariya's fork) preserved as a first-class theme alongside upstream's new LyraCarouselTheme and MinimalTheme.
  • Flow home grammar restored: front Prev/Next iterates the carousel only; side Up/Down jumps to the menu list and iterates within it; carousel cover stays pinned to the last selected book while the user navigates the menu.
  • BookSettingsDrawer hint area enlarged so bottom button labels render without clipping.

Upstream merge brings (v1.2.10 + v1.2.11 + v1.2.11.1)

  • LyraCarouselTheme and MinimalTheme (in addition to the preserved LyraFlowTheme)
  • Recent Books grid view + per-book reading progress in carousel
  • Custom sleep timer picker, in-reader Controls shortcut, bookmark cleanup shortcuts, File Browser long-press actions
  • Richer EPUB parser (better CSS, hyphenation, image sizing, tables)
  • SD-card font system
  • See CHANGELOG.md for the full upstream notes.

Versioning

Field Value Meaning
flexble_version 1.0.0 FlexBLE's own semver — independent of upstream
crossink_version 1.2.11.1 Upstream sync point — meaningful for OTA / bug reports against upstream
version 1.3.0 Inherited upstream CrossPoint version, used by CROSSPOINT_VERSION macro

Scale

  • 325 files changed, +26273 / −3141 lines
  • 17 manual conflict resolutions during merge; remainder auto-merged
  • 5 follow-up integration fixes for chintanvajariya-fork features that the merge surfaced (duplicate drawPerspectiveBitmap, BookStatsActivity constructor mismatch, LyraFlowTheme override signature, Flow input grammar, drawer hint clipping)
  • Field-tested on Xteink X4 with IINE GameBrick BT remote across multiple book formats

Test plan

  • Builds clean on tiny env (RAM 32.5%, Flash 95.3%)
  • Flashed to X4
  • Reads normally — fonts, pagination, sleep all work
  • BLE pairing, reconnect, in-book page-turn all work
  • Chapter-cross with BLE active works on tested books (forward via cache hit, backward via cold re-parse)
  • Font change in-book completes without crashing
  • BT Quick Connect drawer entry behaves correctly with bonded device
  • Back tap during reconnect doesn't cascade out of book
  • After successful BT pair from in-book menu, user lands straight in book
  • Extended reading session test — multiple chapter crossings, fragmentation stability
  • Try a few different EPUBs to see how often the BLE-disable-retry path fires in practice

🤖 Generated with Claude Code

uxjulia and others added 30 commits May 5, 2026 15:14
docs: update readme for v1.2.9.1 table support
…r (#1807)

## Summary

* **What is the goal of this PR?**
Fixes a bug in the jpeg nearest-neighbor downscaler where source image
rows containing visible content may be cropped.

* **What changes are included?**
Split the single `fineScaleFP`/`invScaleFP` scale pair in
`JpegToFramebufferConverter.cpp` into separate X
(`fineScaleFPX`/`invScaleFPX`) and Y (`fineScaleFPY`/`invScaleFPY`)
pairs

## Additional Context
The one case that I encountered in my epub:
<img width="480" height="37" alt="img_6_0"
src="https://github.com/user-attachments/assets/0de3778c-cf3d-42dc-a1ba-4ba729f6b1c4"
/>

The image generated from pxc cache with the latest commit:
<img width="464" height="36" alt="img_6_0_master pxc"
src="https://github.com/user-attachments/assets/92ba06e5-be15-4db6-840e-882bdddb1baf"
/>

With this fix, the bottom outline of each character is still there:
<img width="464" height="36" alt="img_6_0_fixed pxc"
src="https://github.com/user-attachments/assets/4246ce55-5a20-480f-862f-7988f804c1fb"
/>

---

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

Update the Open X4 SDK to point to the CrossPoint organization fork.
This allows us to take SDK changes without being blocked on the upstream
repository.

---

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

Simplify duplicated code in `XtcReaderActivity` to use
`ReaderUtils::detectPageTurn`. This implementation is now shared with
`EpubReaderActivity` and `TxtReaderActivity`. Also deduplicated the
chapter skip time constant.

---

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

Before, any sub-activity of a reader activity needed to override
`isReaderActivity` to maintain correct bookkeeping through
`ActivityManager::isReaderActivity`. We could easily miss this in any
new sub-activities. Instead, simplify so each reader activity correctly
reports and then `ActivityManager` checks for any reader activity in its
stack.

---

### 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**_
Queue the post-pop redraw instead of waiting for it while unwinding nested activities, which avoids the Reader Options back-path render-lock assertion.

Make requestUpdateAndWait() report whether a synchronous render completed or was rejected, and update blocking callers to handle rejected sync renders explicitly instead of relying on an implicit async fallback.

Request redraws after OTA check state transitions so the UI leaves the checking screen for failure, no-update, or confirmation states.

Use an initialized portMUX_TYPE for the ActivityManager render-wait critical sections. ESP-IDF FreeRTOS critical-section APIs take a spinlock parameter, so taskENTER_CRITICAL(nullptr) is not valid on device targets.
docs: update readme for v1.2.9.1 table support
* chore: update GitHub bug report template to include device type
* ci: update release and release candidate workflows
* docs: update readme for v1.2.9.1 table support
* fix: serialize display and SD access on the shared SPI bus to prevent crashes
* fix: prevent blank alert and crash screens
* fix: replace assert with runtime null-check in HalSpiBus mutex init
uxjulia and others added 27 commits May 14, 2026 12:10
## Summary

SD card font fixes:
- `TxtReaderActivity` needs to call `renderer.ensureSdCardFontReady` to
build the advance lookup table to support rendering with SD card fonts.
This revealed that `TxtReaderActivity` was inconsistently performing
layout with `getTextWidth`, when the renderer actually uses
`getTextAdvanceX`, which can lead to minor inconsistencies in alignment.
- Avoid allocating one big `allText` string in
`ParsedText::layoutAndExtractLines`. Instead, pass the vector of word
strings directly to `SdCardFont::buildAdvanceTable`, where the algorithm
just needs to iterate codepoints anyway.

---

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

---------

Co-authored-by: Justin Mitchell <justin@jmitch.com>
## Summary

SD card font fixes:
- `TxtReaderActivity` needs to call `renderer.ensureSdCardFontReady` to
build the advance lookup table to support rendering with SD card fonts.
This revealed that `TxtReaderActivity` was inconsistently performing
layout with `getTextWidth`, when the renderer actually uses
`getTextAdvanceX`, which can lead to minor inconsistencies in alignment.
- Avoid allocating one big `allText` string in
`ParsedText::layoutAndExtractLines`. Instead, pass the vector of word
strings directly to `SdCardFont::buildAdvanceTable`, where the algorithm
just needs to iterate codepoints anyway.

---

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

---------

Co-authored-by: Justin Mitchell <justin@jmitch.com>
# Conflicts:
#	lib/EpdFont/SdCardFont.cpp
Document the Xteink Unlocker tool requirement for third-party purchased
xteink units that ship with USB flashing locked. Include warnings about
bricking risks when flashing unsupported firmwares (e.g. Papyrix) on
locked devices, as they may permanently lock the device with no recovery
path.
Document the Xteink Unlocker tool requirement for third-party purchased
xteink units that ship with USB flashing locked. Include warnings about
bricking risks when flashing unsupported firmwares (e.g. Papyrix) on
locked devices, as they may permanently lock the device with no recovery
path.
# Conflicts:
#	README.md
## Summary
- Fixes #1928 by having the prewarm and advance table functions resolve
fallback styles
---

### AI Usage
Did you use AI tools to help write this code?  YES - Codex

---------

Co-authored-by: Uri Tauber <uritaube@gmail.com>
# Conflicts:
#	lib/EpdFont/SdCardFont.cpp
First stable FlexBLE release post-upstream-merge. FlexBLE now has its own
semver (flexble_version) independent of upstream CrossInk's versioning;
crossink_version tracks the upstream sync point. Settings → System and
the boot log both display "FlexBLE 1.0.0 (CrossInk 1.2.11.1)".

This commit folds together the upstream merge resolution, several FlexBLE
integration fixes that the merged-in code required, and a set of BLE +
heap-management improvements found through extensive on-device testing.

Headline FlexBLE-specific work in this release
- BT Quick Connect action in the Global Book Settings drawer: enables BLE
  and reconnects to the bonded remote (or launches the pair UI if none),
  closes drawer back to the book on success.
- After a successful BLE connect from inside a book, both the BT settings
  activity and the reader menu auto-pop so the user lands straight back
  in the book — no manual back-tapping.
- PackBits-compressed BW backup for the grayscale anti-aliasing pass.
  Single small bounded allocation instead of 12 × 4 KB chunks; typical
  reader pages compress 10-30×. Dramatically reduces fragmentation
  failures when BLE is consuming its ~58 KB.
- Auto-retry on chapter-layout abort: if the parser trips the heap floor
  while BLE is active, FlexBLE silently disables BLE, retries the parse
  with the freed headroom, and lets auto-reconnect restore the link on
  the user's next remote button press.
- LYRA_FLOW theme preserved through the merge as a first-class option,
  with its original input grammar (front Prev/Next within carousel, side
  Up/Down to menu) restored.

Heap-budget tuning for BLE-paired sessions
- MIN_FREE_HEAP_FOR_TEXT_LAYOUT 48→16 KB, MIN_MAX_ALLOC 24→10 KB
- EPUB_INLINE_IMAGE_MIN_FREE 72→56 KB, MIN_MAX_ALLOC 48→32 KB
- All thresholds gracefully fall back to per-allocation failures; no OOM
  crash regression.

UX polish
- Bluetooth main menu uses Up/Down labels and binds both side U/D and
  front L/R to navigation, matching Reader Options / Controls Options.
- BluetoothSettings Confirm handlers switched from wasPressed to
  wasReleased so the release doesn't leak through to the underlying
  reader menu on pop.
- Back release suppressed after long-blocking BLE reconnects so a hasty
  Back tap during the freeze doesn't cascade into a reader exit + BLE
  auto-disable.
- BookSettingsDrawer hint area enlarged so bottom button labels render
  without clipping.

Upstream merge brings (see CHANGELOG for full upstream notes)
- LyraCarouselTheme and MinimalTheme
- Recent Books grid view + per-book reading progress in carousel
- Custom sleep timer picker, in-reader Controls shortcut, bookmark
  cleanup shortcuts, File Browser long-press actions
- Richer EPUB parser (better CSS, hyphenation, image sizing, tables)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@imshentastic
imshentastic merged commit 7631811 into main May 18, 2026
1 of 3 checks passed
imshentastic pushed a commit that referenced this pull request May 23, 2026
* Move to smart pointers and split out ParsedText class

* Cleanup ParsedText

* Fix clearCache functions and clear section cache if page load fails

* Bump Page and Section file versions

* Combine removeDir implementations in Epub

* Adjust screen margins
imshentastic added a commit that referenced this pull request May 23, 2026
FlexBLE 1.0.0: merge upstream CrossInk v1.2.11.1 + BLE-friendly heap budgeting
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.