Skip to content

Commit

Permalink
Async EPD demos: fix iss peterhinch#66.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhinch committed Jun 7, 2024
1 parent 77f5b21 commit 2d50715
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion DRIVERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions gui/demos/epd29_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
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):
Expand Down Expand Up @@ -94,17 +94,17 @@ 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))
asyncio.create_task(multi_fields(evt))
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()
Expand Down
6 changes: 3 additions & 3 deletions gui/demos/epd_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,17 @@ 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))
asyncio.create_task(multi_fields(evt))
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()
Expand Down

0 comments on commit 2d50715

Please sign in to comment.