Add function to adjust gamma#28
Conversation
…l on test device.
|
Interesting, but indeed, hardcoding values that worked on one device may not be the best approach. I wonder if software gamma correction would be too slow? Probably. Perhaps a better approach would be to move the magic numbers to documentation or example code? (ie https://github.com/sajattack/st7735-lcd-examples or a doctest ) ? Anyways, |
|
I pushed a quick commit moving the magic numbers from code to a comment on the adjust_gamma function. I'm open to pushing an example to the examples repo if you desire (I'm working with an ESP-WROOM-32 devboard, which I don't see in the docs already). Although now I'm curious whether the gamma correction is needed in my case due to my TFT module or my microcontroller... |
|
I think this would be a good compromise between a comment and a full-blown example. https://doc.rust-lang.org/rustdoc/write-documentation/documentation-tests.html |
|
I could move the comment to a doc test, but ideally it would need to compile. That would necessitate either bringing in a crate with implementations for at least the SpiDevice and OutputPin traits, or mocking out those traits in code somewhere. I'll defer to you on whether you'd rather add a dev dependency, add dummy trait implementation test code, or just go with a full-blown example. |
Fair enough. |
|
Thanks, I'm going to work on a few more changes on top of this before releasing the next version. |
First of all, thank you for making such a straightforward driver library! Super useful and easy to see what's going on.
I made this PR because of a color issue I was seeing during use. The gamma seemed to be way out of whack, and there wasn't a way to adjust gamma or write raw commands. This new function allows for manually setting the gamma correction values, and I also provided some default positive & negative values that worked well for my device (not sure how globally applicable they are, but figured it didn't hurt).