eXoCooLd / Waveshare.EPaperDisplay

.Net Core Library to show images on Waveshare E-Paper Displays
MIT License
30 stars 13 forks source link

Issue with EPaperDisplayBase and the example program. #15

Closed thecaptncode closed 2 years ago

thecaptncode commented 2 years ago

In the example program a Sleep() is ran on the device. Rightfully so, the example program has a using statement on the device. When this device goes out of scope in the program, it is disposed.

In EPaperDisplayBase, the dispose method ends up calling calls DeviceShutdown() which also does a sleep. With the Epd7in5_V2, and perhaps other devices, issuing a sleep command on a device already asleep takes about 50 seconds, which may be an interface timeout period.

My suggestions to resolve this are, in order of personal preference:
Remove the Sleep() call from the example program. Add some status checks throughout our device drivers before executing functions. Change EPaperDisplayBase's dispose to not call Sleep().

eXoCooLd commented 2 years ago

Yes the Sleep() in the example is unnecessary, lets remove it.

For the EPaperDisplayBase we can add a protected bool property to check if the Sleep() in the Dispose() is realy needed. I think if we set it to true on WakeUp() and false in Sleep() that should work.

eXoCooLd commented 2 years ago

Removed the Sleep from the Example. Added flag to block multiple Sleep calls.