robweber / omni-epd

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

Support for IT8951 devices #57

Closed robweber closed 2 years ago

robweber commented 2 years ago

This is an attempt to add support for IT8951 devices through the use of the Python module from Greg Meyer and found here: https://github.com/GregDMeyer/IT8951. As of right now the status of the driver is as follows:

Installing

Building the omni-epd library using pip3 install . will build and download the IT8951 driver. It will not install any Python requirements as these are not currently part of the setup.py file provided. These can be found on the main repo site. I've started an Issue to get these added but for now it's a hole in the setup.

Using

Once omni-epd is built the driver can be loaded. Easiest case is to use the omni-epd-test utility and specify -e IT8951.it8951 as the EPD type. This should attempt to load the driver, with default settings, and draw the test pattern.

Advanced Options

There is support for changing the default options through the use of the omni-epd.ini file, just as you can with other EPD devices. Below is an example config with the current defaults shown:

[IT8951.it8951]
vcom=-2.06
spi_hz=24000000
rotate=None
txoof commented 2 years ago

For completeness, I'll add this here too.

I had success running the test on Bullseye 32bit with Python 3.9.2 in a Pipenv virtualenv.

$ omni-epd-test -e IT8951.it8951                                     (it8951) X
Loaded IT8951.it8951 with width 1200 and height 825
Drawing rectangle of width 900.0 and height 618.75
Drawing rectangle of width 450.0 and height 309.375
Drawing rectangle of width 112.5 and height 77.34375
Display closed - testing complete

20220222_212705

robweber commented 2 years ago

Awesome - I'm sort of surprised it seemingly works out of the box. Is that a 6'' Waveshare HD? I'll hold of merging in to allow others time to test as well.

Thanks for the quick response!

txoof commented 2 years ago

I was pleasantly surprised as well. Other than the faff with numpy, everything was super smooth.

The one in that shot is a 9.7". I have a small problem and I'm considering seeking help.

I started with a 2.17" just wanting to fool around. Then I got the idea to make a clock/media player thing and bought a 5.83", but that was too small to read across the room so I got a 7".

But then I saw all these cool grayscale screens and now I have a lot of Epaper sitting on my desk(s).

robweber commented 2 years ago

Been sitting on this - I'm thinking maybe just merge it in and deal with any problems as they arise? @txoof - any issues you can see? The code is pretty straightforward but I am a bit concerned there isn't a normal close method that I could find to properly close things out.

txoof commented 2 years ago

@robweber no issues that i could find.

I was concerned about the lack of a close/sleep method as well. I raised it in this issue, but haven't heard back: https://github.com/GregDMeyer/IT8951/issues/39

So far I've been using it as is on two displays a d everything seems ok.

robweber commented 2 years ago

@txoof - Did a little changing - if you could test again that would be great!

I noticed that Waveshare is basically the only EPD type available so I moved the device class to within the Waveshare devices and renamed it waveshare_epd.it8951. I think that will make more sense to people. The rest of the code is pretty much the same, just removed all the logging calls.

If it still works for you I'll merge it in.

txoof commented 2 years ago

I'm away for a few days. I can get to this Monday or Tuesday.

aaronr8684 commented 2 years ago

@robweber While we're waiting on the additional test and if it's not too much trouble, would you be able to rebase this branch to include the tri-color merge? If not, I can just fork it and temporarily work off of mine instead. Just let me know either way 😃

robweber commented 2 years ago

Will do tomorrow morning! I'm in the US so like 10 hours.

aaronr8684 commented 2 years ago

I'm on the east coast...sometimes late is the only time I get to work on this 😅 No rush, have a great night!

txoof commented 2 years ago

@robweber Looks like I'm a little late, but I just tested this against the it8951 screen and it works great.

Nested rectangles appear as expected.

omni-epd-test -e waveshare.it8951 
Loaded waveshare_epd.it8951 with width 1200 and height 825
Drawing rectangle of width 900.0 and height 618.75
Drawing rectangle of width 450.0 and height 309.375
Drawing rectangle of width 112.5 and height 77.34375
Display closed - testing complete
Toksam commented 2 years ago

Add this as another test (I don't know where else to write this)

Successfully got the 10.3" IT8951 up and running!