I took a deeper look into a lot of the pieces of this, and found a part of the problem-
Starting with a CRGBPalette16 object-
CRGBPalette16 newPalette() {
static byte gradientByte[20] = {
0, 3, 3, 3,
64, 13, 13, 255, //blue
128, 3, 3, 3,
192, 255, 130, 3 , //orange
255, 3, 3, 3
};
CRGBPalette16 returnPalette;
returnPalette.loadDynamicGradientPalette(gradientByte);
return returnPalette;
}
I put that onto a simple color wipe, and slowly marched through it- notice the differences between these two outputs-
localCanvas[XY(x,y)] = ColorFromPalette(currentPalette, XY(x,y) + shift, 255, NOBLEND);
localCanvas[XY(x,y)] = ColorFromPalette(currentPalette, XY(x,y) + shift, 255, LINEARBLEND);
You can see the blue flicker in two positions when LINEARBLEND is chosen. I think this is an interference pattern caused by the following-
1- the interpolation from the gradient to the CRGBPalette16 object.
2- the interpolation from the CRGBPalette16 object to a smooth 256-color palette using ColorFromPalette with LINEARBLEND.
As far as solutions go, a few come to mind-
The easy fix is to push the “white” parts of the blue to where they can do less damage-
static byte gradientByte[32] = {
0, 3, 3, 3,
32, 3, 3, 129,
64, 13, 13, 255, //blue
96, 3, 3, 129,
127, 3, 3, 3,
128, 3, 3, 3,
192, 255, 130, 3,// , //orange
255, 3, 3, 3};
A more complete fix would be write a copy of the ColorFromPalette function to use your specific gradient that does the interpolation in one step.
Love your work!