Skip to content

companion: keep mesh/BLE running during e-ink refresh - #3724

Open
akalinin-softvelum wants to merge 2 commits into
meshcore-dev:devfrom
akalinin-softvelum:feature/eink-busy-hook-v2
Open

akalinin-softvelum wants to merge 2 commits into
meshcore-dev:devfrom
akalinin-softvelum:feature/eink-busy-hook-v2

Conversation

@akalinin-softvelum

Copy link
Copy Markdown

Implements #3701. While the e-ink panel refreshes, GxEPD2's busy callback now runs the mesh/interface/sensor loop (loopCore(), shared with loop(), the "inner loop" suggested in #3701), so radio and BLE don't stall during a redraw. Covers the partial refresh, the full wipe and the turnOff() refresh (sleep icon / blank). Other display drivers are unchanged (setBusyHook() is a no-op by default).

Tested on my T-Echo (dev + #3687, companion USB), CLI reply latency while the screen redraws:

  • before: max 2583 ms (partial refresh 356–450 ms, full wipe ~2.5 s)
  • after: max 51 ms with max_partial 0, 71 ms with a full wipe every 3 frames

The turnOff() part was added during the rebase onto #3687 and is only build-tested. Builds OK: T-Echo BLE/USB, ThinkNode M8 BLE, RAK4631 BLE.

@fdlamotte

Use GxEPD2's busy callback to run the mesh, interface and sensor loops
(loopCore(), shared with loop()) while the panel refreshes, instead of
blocking the main loop. Covers the partial refresh in endFrame(), the
full wipe in startFrame(), and the sleep icon / blank refresh on turnOff().
@fdlamotte

fdlamotte commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Seems nice (still need to give it some tests), thanks for the PR ...

Could you add a new build flag to better identify than with DISPLAY_CLASS the builds for which this would be used (something like EINK_REFRESH_LOOP) so we don't build this into every target that uses DISPLAY_CLASS

@ripplebiz do you have any issue with stripping out some portion of the loop so it can be used why waiting in this specific case of active wait ?

edit: gave it a try and it seems to work well

Only builds that define EINK_REFRESH_LOOP install the busy hook; for now
the T-Echo companion BLE/USB envs.
@akalinin-softvelum

Copy link
Copy Markdown
Author

Done: the hook is now enabled only with -D EINK_REFRESH_LOOP, set for the T-Echo companion envs (the only board I could test). Other e-ink boards can opt in by adding the flag.

@fdlamotte

Copy link
Copy Markdown
Collaborator

Nice, I prefer getting an eye from @ripplebiz about the loop before merging it (and I'll probably add the m1, m5 and m8)

I actually tested on M5 and it worked as expected

This branch has not been deployed

No deployments
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.

2 participants