-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
drivers: led_strip: ws2812: Remove scratch selection #64525
drivers: led_strip: ws2812: Remove scratch selection #64525
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks and well caught !
@mbolivar-ampere ping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @thedjnK,
After a second look I think this patch breaks the ws2812_gpio driver. See the ws2812_gpio_update_rgb
fonction. Without the scratch byte and if the targeted color mapping is not RGB, then the red color (and possibly green too) is overwritten.
You can solve the issue by adding some intermediary variables. For example:
/* Convert from RGB to on-wire format (e.g. GRB, GRBW, RGB, etc) */
for (i = 0; i < num_pixels; i++) {
uint8_t r = pixels[i].r;
uint8_t g = pixels[i].g;
uint8_t b = pixels[i].b;
uint8_t j;
for (j = 0; j < config->num_colors; j++) {
switch (config->color_mapping[j]) {
/* White channel is not supported by LED strip API. */
case LED_COLOR_ID_WHITE:
*ptr++ = 0;
break;
case LED_COLOR_ID_RED:
*ptr++ = r;
break;
case LED_COLOR_ID_GREEN:
*ptr++ = g;
break;
case LED_COLOR_ID_BLUE:
*ptr++ = b;
break;
default:
return -EINVAL;
}
}
}
Sorry for missing that with my initial review.
And also for introducing this weakness with 4ada0bb |
@thedjnK are you OK to update this PR ? |
Yes, busy with other things but will get back to this some time |
The WS2812 LED strip driver does not use a scratch byte, therefore free up a byte per pixel which was unused except in the GPIO-based driver whereby it is used Signed-off-by: Jamie McCrae <[email protected]>
3fb629b
to
eb110c4
Compare
eb110c4
to
c8be13c
Compare
c8be13c
to
eb110c4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks !
The WS2812 LED strip driver does not use a scratch byte, therefore free up a byte per pixel which was unused.