#include <Arduino.h>
#include <FastLED.h>

#define LED_ORDER GRB /* Order LED receives RGB data note: WokWi LED ARRAY uses GRB*/
bool kMatrixFlip = false ;
#define LED_PIN 8 /* data pin on Arduino to use for LED Array */
#define LED_TYPE WS2811  /*type of LED strip */
// pixel layout information
// Param for different pixel layouts
// kMatrixFlip = false-> LED 1 is at top left corner
// kMatrixFlip = true-> LED 1 at bottom left corner 
bool kMatrixSerpentineLayout = true;
bool kMatrixVertical = false;

#define MILLIS millis /*function to call to get millisecnods for timimng */

// Params for LED width and height
#define NUMFRAMES 1
const uint8_t kMatrixWidth = 25;
const uint8_t kMatrixHeight = 12;

#define NUM_LEDS (kMatrixHeight*kMatrixWidth)



#define BRIGHTNESS  200
#define FRAMES_PER_SECOND 60

CRGB leds[kMatrixWidth * kMatrixHeight + 1] ; /* this was added for lissajous */

unsigned long time ;

/* define the message to scroll */
int bufWidth = 440;
int bufHeight = 8;
uint8_t buf1[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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int8_t x, uint8_t y)
{
  uint16_t i;

/* bound check added to support lissajous */

  if (x >= kMatrixWidth || y >= kMatrixHeight)
    return NUM_LEDS;
  if (kMatrixFlip == true)
    y = kMatrixHeight - y - 1;

  if (kMatrixSerpentineLayout == false) {
    if (kMatrixVertical == false) {
      i = (y * kMatrixWidth) + x;
    } else {
      i = kMatrixHeight * (kMatrixWidth - (x + 1)) + y;
    }
  }

  if (kMatrixSerpentineLayout == true) {
    if (kMatrixVertical == false) {
      if (y & 0x01) {
        // Odd rows run backwards
        uint8_t reverseX = (kMatrixWidth - 1) - x;
        i = (y * kMatrixWidth) + reverseX;
      } else {
        // Even rows run forwards
        i = (y * kMatrixWidth) + x;
      }
    } else {  // vertical positioning
      if (x & 0x01) {
        i = kMatrixHeight * (kMatrixWidth - (x + 1)) + y;
      } else {
        i = kMatrixHeight * (kMatrixWidth - x) - (y + 1);
      }
    }
  }
  return i;
}

// void shiftDown(int8_t buf[], int width, int height)
// {
//   int8_t tmp[width];
//   int i,j,indx;

//   /* copy bottom row to tmp */
//   for (i=0; i < width;i++)
//     tmp[i]=buf1[(height-1)*width+i];

// /* copy bottom rows */
//   for(j=height-1;j>0;j--)
//     for (i=0; i<width;i++) {
//       indx = (j * width) + i;
//       buf1[indx]=buf1[indx-width];
//   }
//   /* copy top row from tmp */
//   for (i=0; i<width;i++)
//     buf1[i]=tmp[i];
// }

// void shiftUp(int8_t buf[], int width, int height)
// {
//   int8_t tmp[width];
//   int i,j,indx;

//   /* copy top row */
//   for (i=0; i < width;i++)
//     tmp[i]=buf1[i];

//   for(j=0;j<height-1;j++)
//     for (i=0; i<width;i++) {
//       indx = (j * width) + i;
//       buf1[indx]=buf1[indx+width];
//   }
//   for (i=0; i<width;i++)
//     buf1[(height-1)*width+i]=tmp[i];
// }

void shiftLeft(int8_t buf[], int width, int height)
{
  int8_t tmp[height];
  int i, j, indx;

  /* copy first column to tmp */

  for (j = 0; j < height; j++) {
    indx = j * width;
    tmp[j] = buf1[indx] ;
  }
  /* shift columns */
  for (i = 0; i < width - 1; i++)
    for (j = 0; j < height; j++) {
      indx = (j * width) + i;
      buf1[indx] = buf1[indx + 1] ;
    }
  /* move first column to last */

  for (j = 0; j < height; j++) {
    indx = (j * width) + width - 1;
    buf1[indx] = tmp[j] ;
  }
}
    //  if ( ( i < bufWidth ) && (j < bufHeight ) )
void writeled(int8_t buf[], CRGB fontColor, CRGB backgroundColor, int8_t v_offset) {
  int indx, indx1, i, j;

  if (v_offset < 0 )
    v_offset = 0 ;
    for (j = 0 ; j <v_offset; j++)
      for (i=0 ; i<kMatrixWidth; i++)
        leds[XY(i,j)]=backgroundColor ;

  for ( i = 0 ; i < kMatrixWidth ; i++) {
    for ( j = v_offset ; j < kMatrixHeight; j++)
    {
      indx1 = ((j-v_offset) * bufWidth) + i;
      indx = XY(i, j) ;
      if ( ( i < bufWidth && (j-v_offset) < bufHeight) ) {
        leds[indx] = ( buf[indx1] == 1 ) ? fontColor : backgroundColor ;
      }
      else
      {
        leds[indx] = backgroundColor ;
      }
    }
  }
}

void render(int8_t buf[], CRGB fontColor1, CRGB fontColor2, CRGB backgroundColor, int8_t v_offset) {
  int indx, indx1, i, j;

  for ( i = 0 ; i < kMatrixWidth ; i++) {
    for ( j = 0 ; j < kMatrixHeight; j++)
    {
      indx1 = (j* kMatrixWidth) + i;
      indx = XY(i, j) ;
      if ( buf[indx1] == 1 )
        leds[indx] =  fontColor1 ;
      else if ( buf[indx1] == 2 )
        leds[indx] = fontColor2 ;
      else
        leds[indx] = backgroundColor ;
      }
  }
}

void render2(int8_t buf[], CRGB fontColor1, CRGB fontColor2, CRGB fontColor3, CRGB fontColor4, CRGB backgroundColor, int8_t v_offset) {
  int indx, indx1, i, j;

  for ( i = 0 ; i < kMatrixWidth ; i++) {
    for ( j = 0 ; j < kMatrixHeight; j++)
    {
      indx1 = (j* kMatrixWidth) + i;
      indx = XY(i, j) ;
      if ( buf[indx1] == 1 )
        leds[indx] =  fontColor1 ;
      else if ( buf[indx1] == 2 )
        leds[indx] = fontColor2 ;
      else if (buf[indx1] == 3 )
        leds[indx] = fontColor3 ;
      else if (buf[indx1] == 4 )
        leds[indx] = fontColor4 ;
      else
        leds[indx] = backgroundColor ;
      }
  }
}
void scroller(CRGB fontColor, CRGB backgroundColor, int8_t v_offset) {
    writeled(buf1,fontColor,backgroundColor, v_offset) ;
 //   blur2d(leds,kMatrixWidth,kMatrixHeight,172) ;
    FastLED.show();
    delay(5) ;
    shiftLeft(buf1, bufWidth, bufHeight);
//    shiftUp(buf1,bufWidth,bufHeight);
}

void setup() {
  // put your setup code here, to run once:

  FastLED.addLeds<LED_TYPE, LED_PIN, LED_ORDER>(leds, kMatrixWidth * kMatrixHeight);
}

void loop() {
  // put your main code here, to run repeatedly:
  static int count=0;

  for (int i=0;i<bufWidth ; i++)
      scroller(CRGB(221, 0, 255), CRGB::White, 2);
  count++; 

  for (int j = 0 ; j < 1 ; j++)  {
    for (int i = 0 ; i < NUMFRAMES; i++) {
    render2(frame[i],CRGB::CRGB::Gold, CRGB::White, CRGB::Blue, CRGB::Aqua,CRGB::White,0);
    FastLED.show();
    delay(500);
    }
   }
}