Hello all! I am trying to modify the “ColorPalette” preset to start in the middle of a strip and emanate outwards towards each end. I am using 300pixels of WS2811 with a Teensy2.
I modified the code per below, and it works, BUT there is a strange “palette overflow glitch” or somesuch. When I try to create red and green stripes, it works for the most part, but one of the green stripes keeps flashing between green and red as they move down the line. The glitch color is still part of the palette, but its getting confused somehow.
I think it happens at the beginning or end of a loop cycle because of my NUMLEDs not being a multiple of 16? I actually have no idea what is causing it. It only happens on some of the presets, not all of them. I can try to take a video tomorrow if necessary. Any guidance appreciated. Thx!
In the code below, the uncommented portion is the original code, the commented portion is my modified code with the glitch:
void FillLEDsFromPaletteColors( uint8_t colorIndex)
{
uint8_t brightness = 255;
for( int i = 0; i < NUM_LEDS; i++) {
leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
colorIndex += 3;
// for( int i = 0; i <= NUM_LEDS/2; i++) {
// leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
// leds[NUM_LEDS-i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
// colorIndex += 3;
}
}