Skip to content
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

epd.sleep() used? #5

Open
Coernel82 opened this issue Jan 22, 2023 · 5 comments
Open

epd.sleep() used? #5

Coernel82 opened this issue Jan 22, 2023 · 5 comments

Comments

@Coernel82
Copy link
Contributor

Hi Winston,
my display partially does not show clear black but a greyish fade. After some googling this problem is known and seems not to be solved by the community. However I found some information that the display has to be set to sleep mode.

So I added epd.sleep() in my setup and also epd.init() as you used that function in your code already. Waveshare documents def init(self) though. I am a noob - so not sure what to use.

while True:
        # Display the screenshot
        epd.init()  # wake up display
        img = Image.open(BytesIO(driver.get_screenshot_as_png()))
        epd.display(epd.getbuffer(img))
        epd.sleep() # and set it to sleep again
        sleep(refreshRate - time() % refreshRate)

I am not sure if this is correct however I did have a look at the Waveshare library for the 7.5" display and couldn't find a sleep command in the original library.

As documentated by waveshare you should use epd.sleep()

I can confirm that the code works and probably should be altered - at least to save power and probably safe the display from damage.

What do you think? Do you quickly want to add the two lines or would you like to have a pull request?

@Coernel82
Copy link
Contributor Author

One addition:
The demo code for whatever reason does not create the greyish fade but crisp clear black and white images - and as I had a look into the code also uses epd.display(epd.getbuffer(img) so... I have no clue!

@Coernel82
Copy link
Contributor Author

Do you use the HAT on the Raspberry Pi or do you use direct wire connection? Someone wrote that the HAT is unreliable.

@Coernel82
Copy link
Contributor Author

I had a further look at the Waveshare library code and found self.send_command(0x07) # DEEP_SLEEP
As it seems the deep sleep can be triggered by different ways and the direct command is the mentioned above. So from my understanding now epd.sleep() is not necessary in your code.
As you have more understanding of programming I'd be happy if you could confirm that.

@winstonma
Copy link
Owner

winstonma commented Jan 25, 2023

haha I am no expert here. I just followed their demo, and took BenRoe's idea of using selenium's screenshot feature and put things altogether.

The reason I wrote this Python because it can get things done with 30 lines of code (out of this 30 lines of code it mainly comes from the sample code, I only wrote less than 10 lines of code). So I am no expert at all.

By the way I didn't get any of the greyish fade problem.

@winstonma
Copy link
Owner

Let me spend some time on testing the sleep command and get back to you later.

But in my case I am running partial refresh (again, steal the idea from Fast partial refresh on 4.2" E-paper display from Waveshare / Good Display). I think the sleep would slow down the refresh. But I would spend some time of adding sleep during the weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants