You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Aggregates the v4.3 BT + SD-font reading work into a single revertable
baseline. After this commit, BT works with image-heavy and built-in
font books; SD-font book BT enable + first-page render works; the
known limitation is page-turning on text-heavy SD-font chapters
(~28+ elements per page) which crashes due to a per-page deserialize
peak exceeding the post-NimBLE contiguous heap budget by a few
hundred bytes. Permanent fix is the page-DOM arena (Phase 1 of
which is the next planned work).
Notable pieces:
- Embedded glyph subset: per-section v39 trailer holds the codepoints
the chapter actually uses, installed on section load so post-BT
glyph lookups hit in-RAM instead of routing through SdCardFont's
miss-handler under tight heap. Survives BT enable (Option 1 -- a
prior attempt to drop+reload across BT could not reliably re-allocate
the 5.6 KB block after NimBLE fragmented the heap).
- Page-DOM heap reserve: 18 KB pre-allocated chunk acquired lazily on
first chapter open, released for BT enable so NimBLE's ~67 KB
allocation has a clean contiguous slot. Best-effort re-acquire after
BT disconnect.
- TextBlock typography substitutions: curly quotes / dashes / ellipsis
/ various spaces fold to their ASCII equivalents so embedded subsets
built from ASCII-only sources still render correctly.
- SdCardFont: static codepoint buffer in prewarm (saves per-render
2 KB alloc), preflight against 8 KB MaxAlloc floor, lazy non-REGULAR
styles when BT-bonded controller is present.
- BluetoothHIDManager: deinit(true) on disable so stale NimBLEClient
objects from the previous session are released. Previously they
leaked across enable/disable cycles, causing the next connect's
reconnect-with-existing-client path to fail mid-subscribe with
BLE_INIT Malloc-failed and a ~22 s recovery.
- NimBLE platformio.ini knobs tuned down (MAX_CONNECTIONS=1, bonds=1,
MSYS_1_BLOCK_COUNT=4) for the single-gamepad use case.
- Page::elements moved from shared_ptr to unique_ptr (eliminates
per-element control-block alloc).
- Page heap reserve / NimBLE pre-flight gates moved into
EpubReaderActivity's BT-toggle path.
The page-deserialize crash on heavy pages is intentionally NOT
papered over here -- a tried escape valve (drop embedded subset
during deserialize) worked mechanically but broke glyph rendering
because the lazy reinstall could not allocate. Documented inline
in EpubReaderActivity render() so the next attempt has the failure
mode written down.
0 commit comments