-
Notifications
You must be signed in to change notification settings - Fork 914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Async full-refresh for EInkDynamicDisplay #3339
Conversation
Just tested this on the Wireless Paper v1.1 while sending multiple 1-character text messages from another device in the same room quickly after each other. Previously it would sometimes not get an acknowledgment when I saw it doing a full refresh. With this, I can’t reproduce this anymore, even when it’s doing the full refresh. Really nice to finally have a complete solution to this problem! The approach looks solid to me. Do you know if the e-paper of the T-Echo also has this possibility? Currently we’re using only fast updates on that hardware. |
Hopefully it should be as simple as configuring the macros in platformio.ini for the variant, but I hadn't dared to set it for a bunch of devices I can't test first. I've just pushed the same config used for the Wireless Paper v1.1 into T-Echo's platformio.ini; let me know if it works! The values might want some adjusting to get best performance from the T-Echo's display. |
Oh, it’s really that easy -- I really like the modular approach. Also on the T-Echo I don’t miss any packets even when it does the full update. I did not experience a lot of ghosting yet, so maybe we can increase the Edit: One thing I noticed is that when shutting down, it stays on the page saying "Shutting down..." instead of going to the screen that says "Sleeping...". Also when booting, it looks like it skips the boot screen. This also happens on the Wireless Paper. |
responds to meshtastic#3339 (comment)
Will do!
Ah well spotted. I can see where the issues is with shutdown, and I think I can see what might be different about the T-Echo's boot right now. I can't reproduce boot screen issues with the Wireless Paper though. Can you confirm whether the boot screen is skipped for both the T-Echo and the Wireless Paper? Would it be possible to ask for your serial debug log? It might help be hone-in on the problem. |
Yes, for me it skips the boot screen on both the T-Echo and the Wireless Paper v1.1. It's fully white before showing the node list. Here is the boot log from the T-Echo (from e-ink init):
And on shutdown:
And the boot log of the Wireless Paper v1.1:
|
That's definitely weird! Maybe it only works on my device because of a different config taking longer to boot? |
Seems indeed config related. If I disable Wi-Fi, the boot screen shows on the Wireless Paper. |
The plan in the near future was to explicitly mark special frames like boot and sleep screens (in Screen.cpp) with I think what I'll try is adding a |
I'm not able to test it myself, but I believe I do have a fix for the bugs discussed above. Rather than broadening scope, I am submitting this code as-is, and will quickly draft a new pull-request which handles these "special-case" frames, such as boot and sleep. |
Please note that this code requires meshtastic/GxEPD2#6 to work correctly |
Good to hear.
That's fine, it's not a really big issue anyways. Approving (assuming meshtastic/GxEPD2#6 gets merged). |
* Move Wireless Paper V1.1 custom hibernate behavior to GxEPD2 * Async full-refresh for EInkDynamicDisplay * initial config for T-Echo * formatting responds to meshtastic#3339 (comment) * increase fast-refresh limit for T-Echo meshtastic#3339 (comment) * change dependency from private repo to meshtastic/GxEPD2 * rename setFrameFlag() method * move storeAndReset() to end of update() * change order of determineMode() checks * add init code as a determineMode() check * add BLOCKING modifier to frameFlagTypes * add frameFlags to LOG_DEBUG() messages * function macro for tidier addFramFlag() calls * handle special frames in Screen.cpp * fix fallback behavior for unmodified GxEPD2 Issues exposed by meshtastic#3356 (comment) * while drafting, build from todd-herbert/meshtastic-GxEPD2#async * reorder determineMode() checks * Swap Wireless Paper V1.0 dependency to meshtastic/GxEPD2 * purge unused enum val * refactor: remove ACKs in range tests so zero hops is honored (meshtastic#3374) * fix heap use after delete (meshtastic#3373) * fix of tryfix SHT31 sensor (meshtastic#3377) * Don't spam logs if no position with map reporting (meshtastic#3378) --------- Co-authored-by: Todd Herbert <[email protected]> Co-authored-by: Ben Meadors <[email protected]> Co-authored-by: Thomas Göttgens <[email protected]> Co-authored-by: Andre K <[email protected]> Co-authored-by: Manuel <[email protected]> Co-authored-by: GUVWAF <[email protected]>
Aim
Minimize time where display code blocks execution, by running full-refresh asynchronously.
Code summary
A slight modification to GxEPD2 splits the
nextPage()
method into two parts (if variant uses EInkDynamicDisplay). The EInkDisplay base-class callsnextPage()
as normal. If GxEPD2 detects a full refresh, it bypasses both the_WaitWhileBusy()
method, and the remaining code ofnextPage()
.The EInkDynamicDisplay class sets a flag, then returns control to the loop(). As always, the next loop requests a new frame by calling
EInkDynamicDisplay::display()
. While processing new frames, the EInkDynamicDisplay class polls the display's BUSY pin. If it detects a completed async refresh, it calls the newGxEPD2_BW::endAsyncFull()
method, which contains the post-update code transplanted from the original nextPage() method.Prior to merge
lib_deps
for Wireless Paper to point back at meshtastic/GxEPD2 (currently tracking personal repo, for draft)Flow diagram
To aid future maintenance. Traces flow of an async full-refresh between meshtastic/firmware and modified GxEPD2.