feat: add support for partial refresh and setting LUT epd7in5_v2 #249
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Good evening,
I could not get the demo to work for the epd7in5_v2 on my rpi. After a lot of fiddling, I gave up and set about to manually transpile the C demo to rust code, since that one did work. Took me some time, got it working, then started making it idiomatic rust. Then came onto the same issues as I had with the demo here. I managed to solve it. Turns out: you don't need to manually set the CS pin (that is done for you), but you DO need to set the power pin. Without that it won't work. Took the liberty to update the newer CdevPin api as well.
Anyway, I now had a bunch of rust code dealing with raw hexadecimal to drive the display and I noticed that the init functions were all incredibly different. Specifically, the C library has a different init function for full, fast, partial and grasyscale refreshing. Some had power and booster settings, others touched more esoteric stuff. None were setting anything related to refresh modes or LUT.
After a some experimenting, I figured out which commands specifically were responsible for making the refresh modes work and which commands were superfluous.
Apparently, the manufacturers are using a hack: using the temperature override command to select a custom LUT in the OTP memory (better explanation in the code).
I took the liberty of using this knowledge to implement the set_lut function and update_partial_frame functions.
There is also an incredibly cursed hack in the waveshare C libraries that uses the OLD/NEW buffers in the display combined with the temperature override LUT selector hack to fool the display into displaying grayscale (4 shades), which is a feature the website claims. I have not implemented this, as I think it could be harmful for the device itself.
Here a small changelog:
set_lutfor epd7in5_v2PartialRefreshas a mode forRefreshLutupdate_partial framefor epd7in5_v2I hope you will consider my contribution.