Skip to content
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

Handle "special-frames" with EInkDynamicDisplay #3356

Merged
merged 25 commits into from
Mar 11, 2024

Conversation

todd-herbert
Copy link
Contributor

@todd-herbert todd-herbert commented Mar 9, 2024

Aim

Create custom behavior for certain important UI frames

Key changes

  • Init method: aims to provide a consistent start-up behavior between displays.
  • BLOCKING flag: option to block execution while refresh completes.
  • Flags set in Screen class: ensure certain UI frames are drawn with a specific refresh operation.

The flags set in Screen.cpp are largely stylistic choices. Please feel free to suggest any alternate behavior that you would prefer, or any additional behavior you would like added.

Hopefully these changes address the issues identified in #3339 (comment).
@GUVWAF, if you have the time, please do let me know if there has been any improvement (and if it's ready for merge), or if there's anything that could still use attention.

Known issues:

  • If Async Full Refresh GxEPD2#6 has not yet been merged, you may need to temporarily change lib_deps to point at https://github.com/todd-herbert/meshtastic-GxEPD2#async

  • Some Screen class methods (such as setWelcomeFrames(), setSSLFrames()) do not seem to serve any frames to the display class. I'm not sure whether this is just the current situation, or a new issue to look into.

  • When waking from sleep, there is a gap of ~10 seconds between display init and the first frames being served to the display class. I'm not sure whether this would be considered something to explore, or just a normal part of start-up.

Diagrams:

To reduce future headaches. Diagrams are only an outline.

determineMode() Async vs Blocking
flowchart of determine mode method flowchart of asynchronous and block refresh pathways

@GUVWAF
Copy link
Member

GUVWAF commented Mar 9, 2024

This does the trick for the T-Echo. It now shows the boot screen and the “Sleeping…” screen and all looks good.

However, on the Wireless Paper v1.1, it seems to not properly perform the fast updates anymore. It looks like it doesn't properly erase the pixels, see the picture below.

image

When it does the full refresh, it is fixed, but immediately the next frame after a fast refresh is already garbled.
Logs shows that it does the fast refresh with NO_OBJECTIONS and after some refreshes a full one due to EXCEEDED_GHOSTINGLIMIT:

DEBUG | 18:58:54 352 [Screen] determineMode(): ghostPixels=334, refresh=FAST, reason=NO_OBJECTIONS, fastRefreshCount=0, frameFlags=0x3
DEBUG | 18:58:54 352 [Screen] Updating E-Paper... done
DEBUG | 18:58:58 356 [Button] Enter state: ON
DEBUG | 18:58:58 356 [Screen] determineMode(): ghostPixels=486, refresh=FAST, reason=NO_OBJECTIONS, fastRefreshCount=1, frameFlags=0x3
DEBUG | 18:58:58 356 [Screen] Updating E-Paper... done
DEBUG | 18:59:03 361 [Button] Enter state: ON
DEBUG | 18:59:03 361 [Screen] determineMode(): ghostPixels=1294, refresh=FAST, reason=NO_OBJECTIONS, fastRefreshCount=2, frameFlags=0x3
DEBUG | 18:59:03 361 [Screen] Updating E-Paper... done
DEBUG | 18:59:06 364 [Button] Enter state: ON
DEBUG | 18:59:06 364 [Screen] determineMode(): ghostPixels=2151, refresh=FULL, reason=EXCEEDED_GHOSTINGLIMIT, frameFlags=0x3
DEBUG | 18:59:06 364 [Screen] Updating E-Paper... done

@todd-herbert
Copy link
Contributor Author

todd-herbert commented Mar 10, 2024

@GUVWAF Wow thanks for catching that!

I think what has happened is that you might have built the meshtastic/GxEPD2 dependency, which hasn't yet merged meshtastic/GxEPD2#6. Just for the draft, I'll point it at the fork again, but I must remember to revert this before merge.

The reason this upset Wireless Paper v1.1 in particular is that in order to standardize the post-update code, a few lines were moved from the firmware repo, into the GxEPD2 repo.

It's a good thing though that this did come up, because it highlighted two other issues that should now be resolved:

  • Failsafe behavior not selected (in case non-modified GxEPD2 built)
    This doesn't avoid the specific Wireless Paper V1.1 issue from above, but does generally offer some protection

  • Failsafe behavior stuck in endless loop, during post-update code.


Thank you for all your help with testing! If you do have the time, it would be great to hear if the code runs properly now on your hardware.

@GUVWAF
Copy link
Member

GUVWAF commented Mar 10, 2024

I think what has happened is that you might have built the meshtastic/GxEPD2 dependency, which hasn't yet merged meshtastic/GxEPD2#6.

Oh, you’re right. I did change it for the T-Echo, but not for the Wireless Paper -- my bad.

After applying it, all works well. Thanks!

@caveman99 caveman99 marked this pull request as ready for review March 11, 2024 13:05
@caveman99 caveman99 merged commit 6a27e62 into meshtastic:master Mar 11, 2024
69 checks passed
upchui added a commit to upchui/firmware-Meshtastic-Unleashed that referenced this pull request Mar 11, 2024
* 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]>
@todd-herbert todd-herbert deleted the eink-special-frames branch March 18, 2024 12:07
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.

4 participants