kopia lustrzana https://github.com/peterhinch/micropython-nano-gui
Async EPD demos: fix iss #66.
rodzic
77f5b211e5
commit
2d50715e31
|
@ -1172,7 +1172,6 @@ needed in more advanced asynchronous applications and their use is discussed in
|
||||||
modify widgets without risk of display corruption.
|
modify widgets without risk of display corruption.
|
||||||
* `complete` Set when display update is complete. It is now safe to call
|
* `complete` Set when display update is complete. It is now safe to call
|
||||||
`ssd.refresh()`.
|
`ssd.refresh()`.
|
||||||
EPD.
|
|
||||||
|
|
||||||
### 5.1.4 Public bound variables
|
### 5.1.4 Public bound variables
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ from gui.widgets.dial import Dial, Pointer
|
||||||
import gui.fonts.arial10 as arial10
|
import gui.fonts.arial10 as arial10
|
||||||
import gui.fonts.font6 as small
|
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.
|
# Some ports don't support uos.urandom.
|
||||||
# See https://github.com/peterhinch/micropython-samples/tree/master/random
|
# See https://github.com/peterhinch/micropython-samples/tree/master/random
|
||||||
def xorshift64star(modulo, seed=0xF9AC6BA4):
|
def xorshift64star(modulo, seed=0xF9AC6BA4):
|
||||||
|
@ -94,7 +94,7 @@ async def meter(evt):
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
refresh(ssd, True) # Clear display
|
refresh(ssd, True) # Clear display
|
||||||
await ssd.wait()
|
await ssd.complete.wait()
|
||||||
print("Ready")
|
print("Ready")
|
||||||
evt = asyncio.Event()
|
evt = asyncio.Event()
|
||||||
asyncio.create_task(meter(evt))
|
asyncio.create_task(meter(evt))
|
||||||
|
@ -102,9 +102,9 @@ async def main():
|
||||||
asyncio.create_task(compass(evt))
|
asyncio.create_task(compass(evt))
|
||||||
while True:
|
while True:
|
||||||
# Normal procedure before refresh, but 10s sleep should mean it always returns immediately
|
# 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()
|
refresh(ssd) # Launches ._as_show()
|
||||||
await ssd.updated()
|
await ssd.updated.wait()
|
||||||
# Content has now been shifted out so coros can update
|
# Content has now been shifted out so coros can update
|
||||||
# framebuffer in background
|
# framebuffer in background
|
||||||
evt.set()
|
evt.set()
|
||||||
|
|
|
@ -95,7 +95,7 @@ async def main():
|
||||||
# ssd.show()
|
# ssd.show()
|
||||||
# await ssd.wait()
|
# await ssd.wait()
|
||||||
refresh(ssd, True) # Clear display
|
refresh(ssd, True) # Clear display
|
||||||
await ssd.wait()
|
await ssd.complete.wait()
|
||||||
print("Ready")
|
print("Ready")
|
||||||
evt = asyncio.Event()
|
evt = asyncio.Event()
|
||||||
asyncio.create_task(meter(evt))
|
asyncio.create_task(meter(evt))
|
||||||
|
@ -103,9 +103,9 @@ async def main():
|
||||||
asyncio.create_task(fields(evt))
|
asyncio.create_task(fields(evt))
|
||||||
while True:
|
while True:
|
||||||
# Normal procedure before refresh, but 10s sleep should mean it always returns immediately
|
# 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()
|
refresh(ssd) # Launches ._as_show()
|
||||||
await ssd.updated()
|
await ssd.updated.wait()
|
||||||
# Content has now been shifted out so coros can update
|
# Content has now been shifted out so coros can update
|
||||||
# framebuffer in background
|
# framebuffer in background
|
||||||
evt.set()
|
evt.set()
|
||||||
|
|
Ładowanie…
Reference in New Issue