robweber / omni-epd

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

Issue with 3.7 in Waveshare #18

Closed robweber closed 3 years ago

robweber commented 3 years ago

From @ZubaZ21

I love the idea of abstracting this. Very cool.

Pulled it down and ran the test util. It threw an error. File "/usr/local/lib/python3.7/dist-packages/omni_epd/displays/waveshare_display.py", line 251, in prepare self._device.init() TypeError: init() missing 1 required positional argument: 'mode'

I added a 0 so it became self._device.init(0) as that is what the waveshare driver requested.

Fired it off again and got the following.

pi@GeneralPie:~ $ omni-epd-test -e waveshare_epd.epd3in7

Loaded waveshare_epd.epd3in7 with width 280 and height 480 Drawing rectangle of width 210.0 and height 360.0 Drawing rectangle of width 105.0 and height 180.0 Drawing rectangle of width 26.25 and height 45.0 Traceback (most recent call last): File "/usr/local/bin/omni-epd-test", line 10, in sys.exit(main()) File "/usr/local/lib/python3.7/dist-packages/omni_epd/test_utility.py", line 127, in main test.draw() File "/usr/local/lib/python3.7/dist-packages/omni_epd/test_utility.py", line 85, in draw self.draw_on_display(im) File "/usr/local/lib/python3.7/dist-packages/omni_epd/test_utility.py", line 67, in draw_on_display self.epd.display(image) File "/usr/local/lib/python3.7/dist-packages/omni_epd/virtualepd.py", line 202, in display self._display(self.__applyConfig(image)) File "/usr/local/lib/python3.7/dist-packages/omni_epd/displays/waveshare_display.py", line 263, in _display self._device.display(self._device.getbuffer(image)) AttributeError: 'EPD' object has no attribute 'display'

Let me know if you need further testing.

Aaron

robweber commented 3 years ago

Looks like this is a case where an underscore can make all the difference. For the 3.7in model there is a filter to use different functions, including the correct init() and display() methods you're having trouble with. Unfortunately it looks like the parent class is setting the device name improperly. Most likely an artifact of refactoring at some point.

robweber commented 3 years ago

If you get a chance please re-install the library and give it another run (version will be 0.2.2beta1). I think it might really be that simple of a fix.

ZubaZ21 commented 3 years ago

Because I am dumb . . . Re-run the following? sudo pip3 install git+https://github.com/robweber/omni-epd.git#egg=omni-epd

Results: pi@GeneralPie:~ $ sudo pip3 install git+ https://github.com/robweber/omni-epd.git# egg=omni-epd Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already satisfied: omni-epd from git+ https://github.com/robweber/omni -epd.git#egg=omni-epd in /usr/local/lib/python3.7/dist-packages (0.2.1) Requirement already satisfied: waveshare-epd@ git+ https://github.com/waveshare/e- Paper.git#subdirectory=RaspberryPi_JetsonNano/python&egg=waveshare-epd from git+h ttps:// github.com/waveshare/e-Paper.git#subdirectory=RaspberryPi_JetsonNano/pytho n&egg=waveshare-epd in /usr/local/lib/python3.7/dist-packages/waveshareepd-0.0.0 -py3.7.egg (from omni-epd) (0.0.0) Requirement already satisfied: inky[fonts,rpi] in /usr/local/lib/python3.7/dist-p ackages (from omni-epd) (1.2.0) Requirement already satisfied: Pillow in /usr/lib/python3/dist-packages (from omn i-epd) (5.4.1) Requirement already satisfied: numpy in /usr/lib/python3/dist-packages (from wave share-epd@ git+ https://github.com/waveshare/e-Paper.git#subdirectory=RaspberryPi JetsonNano/python&egg=waveshare-epd->omni-epd) (1.16.2) Requirement already satisfied: RPi.GPIO in /usr/lib/python3/dist-packages (from w aveshare-epd@ git+ https://github.com/waveshare/e-Paper.git#subdirectory=Raspberry Pi_JetsonNano/python&egg=waveshare-epd->omni-epd) (0.7.0) Requirement already satisfied: spidev in /usr/lib/python3/dist-packages (from wav eshare-epd@ git+ https://github.com/waveshare/e-Paper.git#subdirectory=RaspberryPi _JetsonNano/python&egg=waveshare-epd->omni-epd) (3.4) Requirement already satisfied: smbus2 in /usr/local/lib/python3.7/dist-packages ( from inky[fonts,rpi]->omni-epd) (0.4.1) Requirement already satisfied: font-fredoka-one; extra == "fonts" in /usr/local/l ib/python3.7/dist-packages (from inky[fonts,rpi]->omni-epd) (0.0.4) Requirement already satisfied: font-hanken-grotesk; extra == "fonts" in /usr/loca l/lib/python3.7/dist-packages (from inky[fonts,rpi]->omni-epd) (0.0.2) Requirement already satisfied: font-source-serif-pro; extra == "fonts" in /usr/lo cal/lib/python3.7/dist-packages (from inky[fonts,rpi]->omni-epd) (0.0.1) Requirement already satisfied: font-intuitive; extra == "fonts" in /usr/local/lib /python3.7/dist-packages (from inky[fonts,rpi]->omni-epd) (0.0.4)

And then fire off the test util?

pi@GeneralPie:~ $ omni-epd-test -e waveshare_epd.epd3in7 Loaded waveshare_epd.epd3in7 with width 280 and height 480 Drawing rectangle of width 210.0 and height 360.0 Drawing rectangle of width 105.0 and height 180.0 Drawing rectangle of width 26.25 and height 45.0 Traceback (most recent call last): File "/usr/local/bin/omni-epd-test", line 10, in sys.exit(main()) File "/usr/local/lib/python3.7/dist-packages/omni_epd/test_utility.py", line 127, in main test.draw() File "/usr/local/lib/python3.7/dist-packages/omni_epd/test_utility.py", line 85, in draw self.draw_on_display(im) File "/usr/local/lib/python3.7/dist-packages/omni_epd/test_utility.py", line 67, in draw_on_display self.epd.display(image) File "/usr/local/lib/python3.7/dist-packages/omni_epd/virtualepd.py", line 202, in display self._display(self.__applyConfig(image)) File "/usr/local/lib/python3.7/dist-packages/omni_epd/displays/waveshare_display.py", line 263, in _display self._device.display(self._device.getbuffer(image)) AttributeError: 'EPD' object has no attribute 'display'

Aaron

On Mon, May 3, 2021 at 4:35 PM Rob @.***> wrote:

If you get a chance please re-install the library and give it another run. I think it might really be that simple of a fix.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/robweber/omni-epd/issues/18#issuecomment-831517389, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATTPCDI6CMUAEUFTVPQF5DLTL4CKDANCNFSM44BOQ4SA .

robweber commented 3 years ago

I would have thought it would pull in the new version with that command but guess not. Try this:

sudo pip3 uninstall omni-epd  

sudo pip3 install git+https://github.com/robweber/omni-epd.git#egg=omni-epd

That should pull it all back in from source again. Then run the test again, hopefully with better results!

ZubaZ21 commented 3 years ago

https://photos.app.goo.gl/nSNvZF11kJfY3jkp6

So. Close!

It does not appear to be clearing the screen but I am 100% seeing the rectangles and able to load my custom image.

Aaron

On Mon, May 3, 2021 at 6:00 PM Rob @.***> wrote:

I would have thought it would pull in the new version with that command but guess not. Try this:

sudo pip3 uninstall omni-epd

sudo pip3 install git+https://github.com/robweber/omni-epd.git#egg=omni-epd

That should pull it all back in from source again. Then run the test again, hopefully with better results!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/robweber/omni-epd/issues/18#issuecomment-831562289, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATTPCDPVEQU7GEEZ7XVV2PTTL4MIVANCNFSM44BOQ4SA .

ZubaZ21 commented 3 years ago

For what it's worth, the waveshare demo is clearing the screen without issue.

On Mon, May 3, 2021 at 6:00 PM Rob @.***> wrote:

I would have thought it would pull in the new version with that command but guess not. Try this:

sudo pip3 uninstall omni-epd

sudo pip3 install git+https://github.com/robweber/omni-epd.git#egg=omni-epd

That should pull it all back in from source again. Then run the test again, hopefully with better results!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/robweber/omni-epd/issues/18#issuecomment-831562289, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATTPCDPVEQU7GEEZ7XVV2PTTL4MIVANCNFSM44BOQ4SA .

robweber commented 3 years ago

The images helped illustrate, thanks! I compared the example code in the Waveshare repo to what we implemented here. This particular display is an oddity compared to the rest. It appears to a need manual clear prior to setting a new image. Others just do this as part of the draw function.

I'll implement something based on the example code. Stay tuned for an update.

robweber commented 3 years ago

I created a new branch with some fixes. Try installing the new branch (uninstall original again with pip3 uninstall) using this:

sudo pip3 install git+https://github.com/robweber/omni-epd.git@waveshare3in7_fixes#egg=omni-epd

That should specify the branch when installing so you get the new changes.

ZubaZ21 commented 3 years ago

Sadly, no change. The screen is 100% not clearing. I regret this display . . . it's the right size for the Pi . . but the driver seems less than useful.

There isn't much output when things run . . is there another log level I can enable to provide more info?

On Tue, May 4, 2021 at 8:31 PM Rob @.***> wrote:

I created a new branch https://github.com/robweber/omni-epd/tree/waveshare3in7_fixeswith some fixes. Try installing the new branch (uninstall original again with pip3 uninstall) using this:

sudo pip3 install @.***_fixes#egg=omni-epd

That should specify the branch when installing so you get the new changes.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/robweber/omni-epd/issues/18#issuecomment-832341850, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATTPCDOCKOKCXYPQQPERZ23TMCGVLANCNFSM44BOQ4SA .

robweber commented 3 years ago

Can I have a little more information on the commands you are running to get the images? Especially between examples 1 and 2 trying to figure out what is happening. Looking at the supplied photos again:

  1. This looks like the regular omni-epd-test run
  2. This one still has the rectangles - did you run this right after the test? If so what command did this image?
  3. The comments on this say "omni-epd", guessing the test utility but with the image parameter?
  4. Waveshare native - did you write something to load the image or modify one of their examples?

In regards to the difference between 3 and 4. By default omni-epd uses b/w only, although this display is capable of 4 color grayscale. You can change the mode to 4 color by using a custom INI file with the mode tag. That might make examples 3 and 4 look more similar.

ZubaZ21 commented 3 years ago

1: Yes. omni-epd-test -e waveshare_epd.epd3in7 2: While the test above was present on the display, I used the image parameter with my image 3: Cleared the screen (using the WS demo) ran the omni image test 4: I modified their demo with my image. (which I could send if you needed that to test with)

I'll retest with the mode tag when I have a sec. Thanks.

On Wed, May 5, 2021 at 10:44 AM Rob @.***> wrote:

Can I have a little more information on the commands you are running to get the images? Especially between examples 1 and 2 trying to figure out what is happening. Looking at the supplied photos again:

  1. This looks like the regular omni-epd-test run
  2. This one still has the rectangles - did you run this right after the test? If so what command did this image?
  3. The comments on this say "omni-epd", guessing the test utility but with the image parameter?
  4. Waveshare native - did you write something to load the image or modify one of their examples?

In regards to the difference between 3 and 4. By default omni-epd uses b/w only, although this display is capable of 4 color grayscale. You can change the mode to 4 color https://github.com/robweber/omni-epd#advanced-epd-control by using a custom INI file with the mode tag. That might make examples 3 and 4 look more similar.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/robweber/omni-epd/issues/18#issuecomment-832746828, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATTPCDIFX4BZOGCK2YKCPCDTMFKWDANCNFSM44BOQ4SA .

txoof commented 3 years ago

@ZubaZ21 and I have been having the same fight with the 3in7 display over on my epaper display project.

Conclusion: the 3in7 display driver from waveshare is a HOT MESS.

robweber commented 3 years ago

@ZubaZ21 - I've finished going through all the different modules and adjusting for any issues. Before publishing this version I'd like confirmation things are working as expected, if possible. If you have some time and can test the 3in7 fixes branch it has all the new code plus the additional clear() call prior to writing an image. Be sure to uninstall any old versions prior to trying this one.


sudo pip3 install git+https://github.com/robweber/omni-epd.git@waveshare3in7_fixes#egg=omni-epd
ZubaZ21 commented 3 years ago

pi@GeneralPie:~ $ sudo pip3 uninstall omni-epd Uninstalling omni-epd-0.2.2b2: Would remove: /usr/local/bin/omni-epd-test /usr/local/lib/python3.7/dist-packages/omni_epd-0.2.2b2.dist-info/ /usr/local/lib/python3.7/dist-packages/omni_epd/ Proceed (y/n)? y Successfully uninstalled omni-epd-0.2.2b2

pi@GeneralPie:~/Projects $ sudo pip3 install git+ @.***_fixes#egg=omni-epd ... Switched to a new branch 'waveshare3in7_fixes' ... Successfully built omni-epd Installing collected packages: omni-epd Successfully installed omni-epd-0.2.2

pi@GeneralPie:~/Projects $ omni-epd-test -e waveshare_epd.epd3in7 Loaded waveshare_epd.epd3in7 with width 280 and height 480 Drawing rectangle of width 210.0 and height 360.0 Drawing rectangle of width 105.0 and height 180.0 Drawing rectangle of width 26.25 and height 45.0 Display closed - testing complete

Rectangles loaded

pi@GeneralPie:~/Projects $ omni-epd-test -e waveshare_epd.epd3in7 -i /home/pi/Projects/e-Paper1/e-Paper/RaspberryPi_JetsonNano/python/pic/A_S2.bmp Loaded waveshare_epd.epd3in7 with width 280 and height 480 Display closed - testing complete

Custom image AND rectangles.

:(

On Fri, May 14, 2021 at 3:01 PM Rob @.***> wrote:

@ZubaZ21 https://github.com/ZubaZ21 - I've finished going through all the different modules and adjusting for any issues. Before publishing this version I'd like confirmation things are working as expected, if possible. If you have some time and can test the 3in7 fixes branch it has all the new code plus the additional clear() call prior to writing an image. Be sure to uninstall any old versions prior to trying this one.

sudo pip3 install @.***_fixes#egg=omni-epd

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/robweber/omni-epd/issues/18#issuecomment-841440940, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATTPCDKYTU5JDQ7DUVDLUCTTNVXPLANCNFSM44BOQ4SA .

robweber commented 3 years ago

Weird. Wonder what's so different between the demo and what we're doing here with the clear() call? The commands are the same and in the same order. I might just buy one of these 3.7in displays as it's vexxing it works so differently.

txoof commented 3 years ago

@robweber I thought the same thing, but couldn't find one at a reputable source for a reasonable price in my area.

robweber commented 3 years ago

Just to keep an update on this I did end up ordering a 3.7in screen. It's currently "in transit". I wanted to make an EPD project for a friend anyway so hopefully can get some hands on experience with this display to close out this issue as well. Stay tuned.

robweber commented 3 years ago

Finally got my 3.7 display in the mail. Just doing some testing I can definitely reproduce this issue. One odd thing is that when using the "gray4" mode everything works fine. Both image updates and clear() function as expected. When in "1gray" (bw) mode you get the previous image artifacts and the clear() function does absolutely nothing that I can tell. Looking at the example code from waveshare I'm wondering if when in 1gray mode it's only doing partial updates of the changed pixels and not clearing the image for a full redraw.

I'll play with this some more but the solution might just be as simple as only allowing the gray4 mode for this display.

ZubaZ21 commented 3 years ago

Yay!

I look forward to magic happening.