Skip to content

Instantly share code, notes, and snippets.

@hpwit
Created May 7, 2021 14:07
Show Gist options
  • Select an option

  • Save hpwit/be99ea334ebc6f8a81673dd206c2c336 to your computer and use it in GitHub Desktop.

Select an option

Save hpwit/be99ea334ebc6f8a81673dd206c2c336 to your computer and use it in GitHub Desktop.
algorithm
uint32_t offp,offi,x,y;
//printf("li%d:\n",line_width);
y=ledtodisp/line_width;
#if SNAKEPATTERN == 1
if(y%2 == 0)
{
x=ledtodisp%line_width;
// off=((x+startleds)%line_width)+y*line_width;
offi=MOD(x+startleds,line_width)+y*line_width;
#if ALTERNATEPATTERN == 1
offp=MOD(x-startleds,line_width)+y*line_width;
#else
offp=offi;
#endif
}
else
{
x=ledtodisp%line_width;
//off=(line_width-x-startleds+1)%line_width+y*line_width;
offi=MOD(x-startleds,line_width)+y*line_width;
#if ALTERNATEPATTERN == 1
offp=MOD(x+startleds,line_width)+y*line_width;
#else
offp=offi;
#endif
}
#else
x=ledtodisp%line_width;
off=((x+startleds)%line_width)+y*line_width;
#endif
// uint8_t *poli = ledt + ((ledtodisp+startleds)%led_per_strip) * nbcomponents;
offi=offi*nb_components;
offp=offp*nb_components;
uint8_t *poli = ledt + offp ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment