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

Fix gamma correction for dotstars #405

Merged
merged 3 commits into from
Feb 2, 2023
Merged

Fix gamma correction for dotstars #405

merged 3 commits into from
Feb 2, 2023

Conversation

brentru
Copy link
Member

@brentru brentru commented Feb 2, 2023

When reviewing my code for optimization, I noticed that gamma correction is (incorrectly) only performed on NeoPixels:

  uint32_t rgbcolorGamma =
      strands[strandIdx].neoPixelPtr->gamma32(pixelsWriteMsg->pixels_color);

For DotStar strands, where the default of neoPixelPtr is set to nullptr, this line will not execute at all.

This pull request adds a new getter function, getGammaCorrectedColor() which returns the gamma-correct RGB hex value. getGammaCorrectedColor() works with both NeoPixel and DotStar strands and also provides error handling.

@brentru brentru merged commit 2001af0 into adafruit:main Feb 2, 2023
@brentru brentru deleted the use-gamma-correction-dotstars branch February 2, 2023 17:20
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.

1 participant