-
Notifications
You must be signed in to change notification settings - Fork 84
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
Possible brightness bug #52
Comments
Interesting, I believe a similar issue might be present in here ikea-led-obegraensad/src/screen.cpp Line 19 in 5ad09fa
Could it be that some data is written beyond the render buffer? My guess is that this might be the actual cause of #49 instead. |
Can this be closed with #64 being merged? |
I am not really sure as it's unclear to me how to interpret
Of course the overflow issue is fixed now but I think the intended usage of |
Hey there,
I just noticed that when calculating brightness when using
Screen.setPixelAtIndex()
orScreen.setPixel()
,uint8_t value
is multiplied withuint8_t brightness
and the result is stored to therenderBuffer
which is an array ofunit8_t
.ikea-led-obegraensad/src/screen.cpp
Lines 96 to 110 in 5ad09fa
I would interpret
value
as well asbrightness
to be something between 0 and 255, but that would quickly lead to an integer overflow, e.g.value = 255, brightness = 255 → renderBuffer[i] = 1
.Is this really the desired behavior? If not, I'd volunteer to implement a fix, but I'd like to discuss the how first.
Thanks!
The text was updated successfully, but these errors were encountered: