adafruit / Adafruit_CircuitPython_EPD

e paper driver for circuit python
MIT License
40 stars 19 forks source link

Speed Increase possible #39

Closed jmfloyd closed 3 years ago

jmfloyd commented 3 years ago

Using the 2.13 monochrome device I was getting 15 sec updates attached to a rpi-zerow. After some debugging I could attribute most of this to the copy of the driver buffer to the device in the library display call. These times were well outside the published specs. By changing the command slightly, I was able to get 2 sec device displays and updates.

The problem area is the spi_transfer calls. I have only looked at the non-sram case. The speed improvement comes from removing the loop.

Original code in epd.py for databyte in self._buffer1: self._spi_transfer(databyte) reduced to self.spi_device.write(self._buffer1) It shows that single byte transfers using the spi transfers is expensive. It may be possible to do something similar with the sram transfers using a small program buffer for the read and write exchange which is what I originally tried. I assume that sram is really there to add screen buffer for very small SBCs. I had assumed that it was hardware linked into the screen operations. On the zero, local program buffer is much faster.

With this change, the main time is now in the update method which is independent of the driver. Buffer handling in the driver is now around 0.05 seconds compared to the update of 2.1 secs.

Also not sure why a 2nd buffer is allocated for a monchrome hardware in the drivers which wont be used eg ssd1675

Cheers John

ladyada commented 3 years ago

hi the reason is that some EPDs require special behavior for SPI transfers, you can see it here https://github.com/adafruit/Adafruit_CircuitPython_EPD/blob/master/adafruit_epd/epd.py#L200 on linux you dont need SRAM pin, set it to None

ladyada commented 3 years ago

note of cousre that you can only update EPDs every 3 minutes anyways

evaherrada commented 3 years ago

Closing. @jmfloyd if you feel this isn't resolved, I can reopen.