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

Add per-channel user-settable gamma correction #171

Merged
merged 18 commits into from
Jul 6, 2017
Merged

Add per-channel user-settable gamma correction #171

merged 18 commits into from
Jul 6, 2017

Conversation

Gadgetoid
Copy link
Collaborator

This change adds per-channel user-settable gamma correction which uses a single set of values to correct intensity values for all LED elements- Red, Green, Blue and White.

The default gamma table is uncorrected, in Unicorn HAT we use:

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5,
6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 11, 11,
11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18,
19, 19, 20, 21, 21, 22, 22, 23, 23, 24, 25, 25, 26, 27, 27, 28,
29, 29, 30, 31, 31, 32, 33, 34, 34, 35, 36, 37, 37, 38, 39, 40,
40, 41, 42, 43, 44, 45, 46, 46, 47, 48, 49, 50, 51, 52, 53, 54,
55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
71, 72, 73, 74, 76, 77, 78, 79, 80, 81, 83, 84, 85, 86, 88, 89,
90, 91, 93, 94, 95, 96, 98, 99,100,102,103,104,106,107,109,110,
111,113,114,116,117,119,120,121,123,124,126,128,129,131,132,134,
135,137,138,140,142,143,145,146,148,150,151,153,155,157,158,160,
162,163,165,167,169,170,172,174,176,178,179,181,183,185,187,189,
191,193,194,196,198,200,202,204,206,208,210,212,214,216,218,220,
222,224,227,229,231,233,235,237,239,241,244,246,248,250,252,255

But I did not want to foist a default which might suddenly change behaviour upon unsuspecting users.

It's not ideal, so I'm open to suggestions for improvements, but currently the gamma table must be set following init, where the table is allocated in memory and the default values are stored.

Actually, would it be sensible to simply check for NULL on the uninitialised pointer and only initialise it only if it doesn't already contain the address of a gamma table array?

https://github.com/pimoroni/rpi_ws281x/blob/master/ws2811.c#L937-L942

@jgarff
Copy link
Owner

jgarff commented May 20, 2017

Thanks for the pull request. I'd like to merge this but it has quite a few other changes in the history, some of which I just merged. Would you mind rebasing it to the current tip of master and resubmit? Thanks.

darinkes and others added 6 commits May 20, 2017 09:35
* updated documentation on GPIO usage
strandtest now defaults to GRB colour order
added version.h to gitignore

* updated python readme

* more README cleanup

* added notes on spi max transfer size
@jgarff jgarff merged commit aee7ccc into jgarff:dev Jul 6, 2017
dpenezic added a commit to dpenezic/rpi_ws281x that referenced this pull request Jan 10, 2018
Add per-channel user-settable gamma correction (jgarff#171)
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

Successfully merging this pull request may close these issues.

6 participants