diff --git a/drivers/epaper/epaper2in7_fb.py b/drivers/epaper/epaper2in7_fb.py index 572a3ea..69b7484 100644 --- a/drivers/epaper/epaper2in7_fb.py +++ b/drivers/epaper/epaper2in7_fb.py @@ -131,6 +131,7 @@ class EPD(framebuf.FrameBuffer): print('wait_until_ready {}ms {:5.1f}mins'.format(dt, dt/60_000)) async def wait(self): + await asyncio.sleep_ms(0) # Ensure tasks run that might make it unready while not self.ready(): await asyncio.sleep_ms(100) diff --git a/drivers/epaper/epd29.py b/drivers/epaper/epd29.py index edd3c0b..8241fa8 100644 --- a/drivers/epaper/epd29.py +++ b/drivers/epaper/epd29.py @@ -109,17 +109,14 @@ class EPD(framebuf.FrameBuffer): print('Init Done.') # For use in synchronous code: blocking wait on ready state. - # TODO remove debug code from Waveshare fiasco. def wait_until_ready(self): sleep_ms(50) - t = ticks_ms() while not self.ready(): sleep_ms(100) - dt = ticks_diff(ticks_ms(), t) - print('wait_until_ready {}ms {:5.1f}mins'.format(dt, dt/60_000)) # Asynchronous wait on ready state. Pause (4.9s) for physical refresh. async def wait(self): + await asyncio.sleep_ms(0) # Ensure tasks run that might make it unready while not self.ready(): await asyncio.sleep_ms(100) diff --git a/gui/demos/epd29_async.py b/gui/demos/epd29_async.py index ae10c5f..2e60205 100644 --- a/gui/demos/epd29_async.py +++ b/gui/demos/epd29_async.py @@ -31,7 +31,7 @@ def xorshift64star(modulo, seed = 0xf9ac6ba4): return (x * 0x2545F4914F6CDD1D) % modulo return func -async def compass(evt): # TODO why does this not get drawn on 1st pass? +async def compass(evt): wri = Writer(ssd, arial10, verbose=False) wri.set_clip(False, False, False) v1 = 0 + 0.9j @@ -42,7 +42,6 @@ async def compass(evt): # TODO why does this not get drawn on 1st pass? while True: ptr.value(v1) v1 *= v2 -# await asyncio.sleep_ms(100) await evt.wait()