robweber / omni-epd

An EPD (electronic paper display) class abstraction to simplify communications across multiple display types.
GNU General Public License v3.0
83 stars 19 forks source link

Add Partial Update Support #68

Open aaronr8684 opened 2 years ago

aaronr8684 commented 2 years ago

If I have time, I can work on a solution, but in the meantime, I'm just going to add this here as a future feature request. Not sure if MissionFloyd wants to take a crack at it. I imagine that it could be another mode since only the bw/grey screens seem to support it.

Screens with official partial update support:

robweber commented 2 years ago

Just to add to this a bit I can see a few hurdles to the partial implementation. T

Project Developer Experience

We'll need a unified way of flagging what screens support it and which don't. This will more than likely require some sort of partial_supported boolean being added to the VirtualEPD class. This would allow developers to code around support easily.

When trying to use the partial update functionality a developer could call epd.display(image, partial=True). If the screen supports partial updates that method would be used vs the full update. A point of debate here would be what does omni-epd do as a fallback?

  1. Do a full update if partial is not supported? This may cause issues with parts of the expected image just not working
  2. Throw an error, something along the lines of Partial Update not supported

Neither of these are ideal. The alternative would be that the developer will need to check if the display supports partial updating and code their stuff accordingly. An alternative might be making the developer code for if(epd.partial_supported) and call either display() or display_partial() as appropriate. The latter could still throw an error if called the screen didn't support it?

Driver Implementation

Often the displays that support partial refresh use separate init() and display() functions for the partial update, or you need to pass in some kind of variable to alert the driver to the fact that you're doing a partial update. A child class _display_partial() could be implemented for devices that allow for partial display. Similarly the prepare() method will need both a full and partial update check as well.

Nico04 commented 9 months ago

I'm new here, looking for a good library to control FAST refreshing EPD like the Waveshare 6inch IT8951 display. Partial refreshing is also key for fast refresh. This project looks very promising, do you know if this feature is implemented yet? Thanks 😊

robweber commented 9 months ago

It is not implemented. Personally I don't have a screen that supports it for testing. To even get one working it would take someone with a partial display EPD to flesh out the details, implement, and test. Once one is working the code could likely be applied to the others that support it.

W11T commented 1 month ago

I tried omni-epd with a waveshare_epd.epd1in54_V2. omni-epd-test fails with

Loaded waveshare_epd.epd1in54_V2 with width 200 and height 200
Drawing rectangle of width 150.0 and height 150.0
Drawing rectangle of width 75.0 and height 75.0
Drawing rectangle of width 18.75 and height 18.75
Traceback (most recent call last):
  File "/media/pi/INTENSO/RBP-IN/home/welf/bin/epd/venv_epd/bin/omni-epd-test", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/media/pi/INTENSO/RBP-IN/home/welf/bin/epd/venv_epd/lib/python3.11/site-packages/omni_epd/test_utility.py", line 138, in main
    test.draw()
  File "/media/pi/INTENSO/RBP-IN/home/welf/bin/epd/venv_epd/lib/python3.11/site-packages/omni_epd/test_utility.py", line 84, in draw
    self.__draw_on_display(im)
  File "/media/pi/INTENSO/RBP-IN/home/welf/bin/epd/venv_epd/lib/python3.11/site-packages/omni_epd/test_utility.py", line 64, in __draw_on_display
    self.epd.prepare()
  File "/media/pi/INTENSO/RBP-IN/home/welf/bin/epd/venv_epd/lib/python3.11/site-packages/omni_epd/displays/waveshare_display.py", line 129, in prepare
    self._device.init()
TypeError: EPD.init() missing 1 required positional argument: 'isPartial'

Looks like this parameter is requested by the waveshare drivers:

venv_epd/lib64/python3.11/site-packages/waveshare_epd/epd1in54_V2.py:    def init(self, isPartial):
venv_epd/lib64/python3.11/site-packages/waveshare_epd/epd1in54_V2.py:        if(isPartial):
robweber commented 1 month ago

Just wanted to note here that I did see this. I'll probably break this out into it's own issue as the "fix" will be to just add the argument as False given that this library does not support partial refresh right now. This will get the omni-epd class working in line with how the other displays function.