eXoCooLd / Waveshare.EPaperDisplay

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

Small performance tweak #5

Closed thecaptncode closed 3 years ago

thecaptncode commented 3 years ago

I found a tweak in the base class protected void SendData(byte[] data) method that seems to be giving me about a 10% performance improvement when updating the display. Setting the hardware pins for each byte appears to be unnecessary and I have confirmed other drivers that are only setting the pins before and after all of the data is sent. Doing so is working fine on my hardware.

If you are okay with this change, I can push it up to GitHub, or you can make the change yourself. Whichever is your preference.

Also, according to your last commit message the test coverage is at 95%. Are there additional test cases you would like me to add? I can certainly do so if you wish.

If you want to contact me directly, my email address is now in my profile.

Best regards, Greg

eXoCooLd commented 3 years ago

Nice, just create a Pull request and I test it on my display too / add it to the Main Branch.

The coverage is 95% because I can't test the parts with the GPIO Hardware (see EPaperDisplayHardwareTests.cs) Maybe Microsoft Fakes will work for that, insted of Moq. But I think 95% is a very good test coverage :-)

Best regards, André

thecaptncode commented 3 years ago

The pull request has been created.

I have also tested this compiled with version 5.0 RC2 of System.Drawing.Common and this worked fine. Would you be interested in compiling the project as dot net 5.0 after it comes out this Tuesday? Presumably the full release of System.Drawing.Common 5.0 will also be out on the same day.

According to this [https://devblogs.microsoft.com/dotnet/the-future-of-net-standard/](The Future of Net Standard) .NET 5 and all future versions will always support .NET Standard 2.1 and earlier. The only reason to retarget from .NET Standard to .NET 5 is to gain access to more runtime features, language features, or APIs. So, you can think of .NET 5 as .NET Standard vNext.

eXoCooLd commented 3 years ago

Thx for the Pull Request, I will test it on the weekend.

I need to look how to support both .NET Standard and .NET 5 in the NuGet Package. Not all .NET Core Projects will upgrade to .NET 5, letz give them some update time :-)

thecaptncode commented 3 years ago

I'm glad to help.

By the way, I see that there are some package updates available now including the one used for mocking.

Fair point about .NET. The article I linked above discusses some of that. I'm sure more information is available elsewhere on the net. I don't see this ever needing to support .NET Framework because the hardware needed for GPIO but Mono and Xamarin are possibilities.

Please have a good week. Cheers, Greg

thecaptncode commented 3 years ago

In case you wanted to see what I am currently using this driver for, I have published my progress so far into this repository. https://github.com/thecaptncode/IoTDisplay

Greg

eXoCooLd commented 3 years ago

Very nice project! I use my display to show data from OpenHAB too :-)

eXoCooLd commented 3 years ago

Thx for the Pull Request. Works on my display too and is now merged into the Main Branch.

thecaptncode commented 3 years ago

Thank you and I appreciate you managing the repo and NuGet package.
I am going to have to look at OpenHAB. I've been using Hubitat which I understand was started by some former employees of Samsung who wanted SmartThings to move in a different direction. It has been way better than SmartThings but OpenHAB looks very cool. Thanks for mentioning it.