These are chat archives for Makuna/NeoPixelBus

23rd
Dec 2018
Benik3
@Benik3
Dec 23 2018 19:39
Hi again.
Simple question, is possible to backward get current set pixel in order RGB?
If I take data from strip.pixels() it's in order GRB (because of HW WS2812) and I thought that I could omit one buffer with current values.
Thank you
Benik3
@Benik3
Dec 23 2018 21:42
I played with smoothing through LinearBlend. It works pretty nice but the hsb Blend takes around 55us for LED (that's 5,5ms for 100LEDs).
What I found interesting is, that blend of same colour (so there is nothing to blend) takes more time then e.g. from black to red (in my test around 1ms more for 110LEDs).
Does it take so long because of more operations with float? When I tested RGB blend it was only around 9us/LED
Here is SW on which I tested the smoothing https://github.com/Benik3/Adalight_WS2812_ESP8266_Non-blocking/tree/Smoothing
Michael Miller
@Makuna
Dec 23 2018 23:01
ANNOUNCEMENT: New release 2.4.0 was just made. It now supports Uart0 and Uart1 at the same time. There is still the caveat about using Async versions will stop you from using the Serial objects due to the ISR they use and I would require and no sharing support is present yet.
But now you can use three (DMA, UART0, and UART1) to send data out.
@Benik3 First question, by "backward get current set of pixels", do you mean how to do convert them to RGB from the native pixel format? Naturally, you can just call GetPixelColor on each pixel and it will do this for you.
Michael Miller
@Makuna
Dec 23 2018 23:06
@Benik3 When you are doing the HSB blend (or HSL), are you starting with a RGB color or HSB(HSL) color? Code snippet of the blend code would help clarify this.
Benik3
@Benik3
Dec 23 2018 23:15
I start with RGB, I posted link to the code :)
Michael Miller
@Makuna
Dec 23 2018 23:15
@Benik3 I would suggest NOT using the current color as a starting point for animations. It has to convert the RGBColor to HSBColor (not simple) and then convert it back. This takes a lot of work.
A better approach is to think along the lines of I have "one" picture that I want to blend to another "picture". And these pictures are in the format you want to blend with, in your case HSB.
Please don't force me to read a bunch of code, it is more polite to include the snippets but still include the link for more context.
Is there a reason you want HSL blending versus RGB blending?
Benik3
@Benik3
Dec 23 2018 23:26
The conversion will be probably the problem.
Because here is what I did
for (uint8_t i = 0; i < PixelCount; i++)
    {

      RgbColor color = HsbColor::LinearBlend<NeoHueBlendShortestDistance>(HsbColor(RgbColor (startBuff[i * 3], startBuff[(i * 3) + 1], startBuff[(i * 3) + 2])), HsbColor(RgbColor (endBuff[i * 3], endBuff[(i * 3) + 1], endBuff[(i * 3) + 2])), progress);
      strip.SetPixelColor(i, color);
      currentBuff[i * 3] = color.R;
      currentBuff[(i * 3) + 1] = color.G;
      currentBuff[(i * 3) + 2] = color.B;

    }
strip.Show();
I wanted the hsl blanding because it look better when you go from one color to another then with simple RGB
Michael Miller
@Makuna
Dec 23 2018 23:26
Further, its better to apply gamma as the last action before setting the color.
Benik3
@Benik3
Dec 23 2018 23:28
When I tried to apply the gamma after the result of blending Red to Green showed on 16 pixels the result without gamma looks better. Otherwise the ends (red and green LEDs) was too similar.
Michael Miller
@Makuna
Dec 23 2018 23:28
Convert when you recieve to HSB buffer, then use that to blend and finally populate the strip.
Gamma is releated to the hardware LEDs, you need to retain the original intent of the colors as you blend/etc; and only apply the gamma as the last step. If it doesn't look good, then the original intent is wrong.
Benik3
@Benik3
Dec 23 2018 23:33
When I tried your example for gamma it looks better of course with the gamma. Then I just changed the blending function to get red to green (instead of one color from 0 to 100% brightness) and it was better without gamma (the gradient had better colour steps)
Michael Miller
@Makuna
Dec 23 2018 23:33
This is also why I don't suggest calling GetPixelColor generally.
Benik3
@Benik3
Dec 23 2018 23:43
Maybe just the library gamma table doesn't fit 100% my strip.
It's true that with the gamma correction I have two first LED off completely.