From 2d50715e31ac194257be6439a39cdfb756a5fcc5 Mon Sep 17 00:00:00 2001 From: Peter Hinch Date: Fri, 7 Jun 2024 14:55:19 +0100 Subject: [PATCH] Async EPD demos: fix iss #66. --- DRIVERS.md | 1 - gui/demos/epd29_async.py | 8 ++++---- gui/demos/epd_async.py | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/DRIVERS.md b/DRIVERS.md index 9909c65..4a36690 100644 --- a/DRIVERS.md +++ b/DRIVERS.md @@ -1172,7 +1172,6 @@ needed in more advanced asynchronous applications and their use is discussed in modify widgets without risk of display corruption. * `complete` Set when display update is complete. It is now safe to call `ssd.refresh()`. - EPD. ### 5.1.4 Public bound variables diff --git a/gui/demos/epd29_async.py b/gui/demos/epd29_async.py index 124624d..427c897 100644 --- a/gui/demos/epd29_async.py +++ b/gui/demos/epd29_async.py @@ -19,7 +19,7 @@ from gui.widgets.dial import Dial, Pointer import gui.fonts.arial10 as arial10 import gui.fonts.font6 as small -ssd._asyn = True # HACK to make it config agnostic +# ssd._asyn = True # HACK to make it config agnostic # Some ports don't support uos.urandom. # See https://github.com/peterhinch/micropython-samples/tree/master/random def xorshift64star(modulo, seed=0xF9AC6BA4): @@ -94,7 +94,7 @@ async def meter(evt): async def main(): refresh(ssd, True) # Clear display - await ssd.wait() + await ssd.complete.wait() print("Ready") evt = asyncio.Event() asyncio.create_task(meter(evt)) @@ -102,9 +102,9 @@ async def main(): asyncio.create_task(compass(evt)) while True: # Normal procedure before refresh, but 10s sleep should mean it always returns immediately - await ssd.wait() + await ssd.complete.wait() refresh(ssd) # Launches ._as_show() - await ssd.updated() + await ssd.updated.wait() # Content has now been shifted out so coros can update # framebuffer in background evt.set() diff --git a/gui/demos/epd_async.py b/gui/demos/epd_async.py index 8e92c3c..b86a30b 100644 --- a/gui/demos/epd_async.py +++ b/gui/demos/epd_async.py @@ -95,7 +95,7 @@ async def main(): # ssd.show() # await ssd.wait() refresh(ssd, True) # Clear display - await ssd.wait() + await ssd.complete.wait() print("Ready") evt = asyncio.Event() asyncio.create_task(meter(evt)) @@ -103,9 +103,9 @@ async def main(): asyncio.create_task(fields(evt)) while True: # Normal procedure before refresh, but 10s sleep should mean it always returns immediately - await ssd.wait() + await ssd.complete.wait() refresh(ssd) # Launches ._as_show() - await ssd.updated() + await ssd.updated.wait() # Content has now been shifted out so coros can update # framebuffer in background evt.set()