Waveshare EPD: fix bug in async driver.

pull/9/merge
peterhinch 2023-03-15 13:00:36 +00:00
rodzic 85153624c0
commit fe90bfaa1b
3 zmienionych plików z 27 dodań i 7 usunięć

Wyświetl plik

@ -59,11 +59,11 @@ access via the `Writer` and `CWriter` classes is documented
     5.1.3 [EPD public bound variables](./DRIVERS.md#513-epd-public-bound-variables)
     5.1.4 [FeatherWing Wiring](./DRIVERS.md#514-featherwing-wiring)
     5.1.5 [Micropower use](./DRIVERS.md#515-micropower-use)
5.2 [Waveshare eInk Display HAT](./DRIVERS.md#52-waveshare-eink-display-hat)
5.2 [Waveshare eInk Display HAT](./DRIVERS.md#52-waveshare-eink-display-hat) Pi HAT repurposed for MP hosts.
     5.2.1 [EPD constructor args](./DRIVERS.md#521-epd-constructor-args)
     5.2.2 [EPD public methods](./DRIVERS.md#522-epd-public-methods)
     5.2.3 [EPD public bound variables](./DRIVERS.md#523-epd-public-bound-variables)
5.3 [Waveshare 400x300 Pi Pico display](./DRIVERS.md#53-waveshare-400x300-pi-pico-display)
5.3 [Waveshare 400x300 Pi Pico display](./DRIVERS.md#53-waveshare-400x300-pi-pico-display) Can also be used with other hosts.
6. [EPD Asynchronous support](./DRIVERS.md#6-epd-asynchronous-support)
7. [Writing device drivers](./DRIVERS.md#7-writing-device-drivers)
8. [Links](./DRIVERS.md#8-links)
@ -1240,6 +1240,24 @@ following constructor args:
* `busy=None` A `Pin` instance defined as `Pin.IN, Pin.PULL_UP`.
* `asyn=False` Set `True` for asynchronous applications.
##### Synchronous methods
* `init` No args. Issues a hardware reset and initialises the hardware. This
is called by the constructor. It needs to explicitly be called to exit from a
deep sleep.
* `sleep` No args. Puts the display into deep sleep. If called while a refresh
is in progress it will block until the refresh is complete. `sleep` should be
called before a power down to avoid leaving the display in an abnormal state.
* `ready` No args. After issuing a `refresh` the device will become busy for
a period: `ready` status should be checked before issuing `refresh`.
* `wait_until_ready` No args. Pause until the device is ready.
##### Asynchronous methods
* `updated` Asynchronous. No args. Pause until the framebuffer has been copied
to the display.
* `wait` Asynchronous. No args. Pause until the display refresh is complete.
An alternative driver supporting partial updates is `pico_epaper_42_part.py`.
Usage is as above, but the driver supports two methods:
* `set_partial()`

Wyświetl plik

@ -204,9 +204,10 @@ class EPD(framebuf.FrameBuffer):
async def _as_show(self):
self.send_command(b"\x13")
for j in range(_EPD_HEIGHT): # Loop would take ~300ms
for j in range(_EPD_HEIGHT): # Loop blocks ~300ms
self._line(j)
await asyncio.sleep_ms(0)
# For some reason the following did not work
#await asyncio.sleep_ms(0)
self.send_command(b"\x12") # Async .display_on()
while not self.busy_pin():
await asyncio.sleep_ms(10) # About 1.7s

Wyświetl plik

@ -221,7 +221,7 @@ class EPD(framebuf.FrameBuffer):
self.send_bytes(EPD_partial_lut_bb1)
def wait_until_ready(self):
while(not self.ready()):
while not self.ready():
self.send_command(b"\x71")
time.sleep_ms(100)
@ -249,9 +249,10 @@ class EPD(framebuf.FrameBuffer):
async def _as_show(self):
self.send_command(b"\x13")
for j in range(_EPD_HEIGHT): # Loop would take ~300ms
for j in range(_EPD_HEIGHT): # Loop blocks ~300ms
self._line(j)
await asyncio.sleep_ms(0)
# For some reason the following did not work
# await asyncio.sleep_ms(0)
self.send_command(b"\x12") # Async .display_on()
while not self.busy_pin():
await asyncio.sleep_ms(10) # About 1.7s