-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add grayscale support for B/W displays #166
Comments
This is something I've wanted to do for a while, but will take some overhaul of the underlying epdlib that manages all of the display interface. Once that's done, it would be relatively easy to add into PaperPi. Right now there are three classes of devices that are supported by epdlib: HD, 1 Bit and 7 Color. The HD screens all support grayscale, but the oddballs like the 2in7 aren't supported (yet). The basic problems is that the 2in7 and others have oddball methods that require a lot of extra code to manage for writing in grayscale and also for managing the other color layers. The Screen.writeEPD() method would need to be adjusted to handle additional write functions loaded from the waveshare drivers. Unfortunately I'm pretty swamped with other commitments right now and don't have access to my 2in7 display for testing. If you're interested in tackling the epdlib side of things, I can offer some support and guidance, but I can't do much right now. PRs are always welcome! |
I'll see what I can do. My python skills are very basic so I can't promise anything. @txoof Can you please confirm the following?
|
You're on the right track. The HD displays are managed with another, non-waveshare driver altogether. The To test if this works, create an If you need some hints on setting up a screen object and pushing images to it, look at the Looking at the blame, it looks like it's been at least 4 years since I thought about this, so I'm just going by comments and the logic there and that might be...wrong. Let me know what you get to and I'll try to give some more pointers. |
Looking at the Waveshare catalog, these are the device classes:
Not quite. This indicates a screen from class 4/5/6. Should be pretty straight-forward to implement for that case. Let me look into it. edit What I get from the driver code:
|
There are some adustments needed in PaperPi Lines 682 to 691 in 224a7cb
|
Is your feature request related to a problem? Please describe.
I have a 2.7 inch Waveshare HAT with a resolution of 264x176. On such a small screen, fonts are mostly hard to read without antialiasing.
Example with PaperPi: https://i0.wp.com/dronebotworkshop.com/wp-content/uploads/2022/02/paperpi-weather.png
Describe the solution you'd like
The display supports 4 shades of gray, as can be seen in https://github.com/waveshareteam/e-Paper/blob/master/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in7.py#L436.
This also seems to apply to other models.
To use it, one must create a 4 color image with palette
#000000, #808080, #c0c0c0, #ffffff
, and callinit_4Gray
,getBuffer_4Gray
anddisplay_4Gray
instead of the methods without the_4Gray
suffix.Describe alternatives you've considered
More dithering in black & white doesn't help.
Additional context
For comparison, I converted the same input image to B/W and 4 colors, and the difference is significant:
Input image here
The text was updated successfully, but these errors were encountered: