DMXSerial und FastLED + LEDMatrix

Hallo zusammen,

ich habe folgendes Problem:

Ich habe hier ein Programm das über DMX ein 8x8 LED Matrix steuert.
Ich habe schon öfters über DMX LED gesteuert, nun habe ich das Problem das irgend wo zwei vectoren doppelt beschrieben werden.

Man findet zu ähnlichen Problemen mit DMX Serial Lösungen nur diese halfen hier nicht.

Für euch hier mal der Programm Entwurf darauf anschließend die Fehlermeldung.

Danke euch.

Programm:

/***************************************************************
 Project:     DMX IN und Feuer Steuerung Lucas
 Librarys:   DMXSerial.h
 Writer:      LucasK.
 ***************************************************************/
//FASTLED
#include <DMXSerial.h>

#include <FastLED.h>        //https://github.com/FastLED/FastLED
#include <LEDMatrix.h>      //https://github.com/Jorgen-VikingGod/LEDMatrix

// Change the next defines to match your matrix type and size
#define DATA_PIN            6

#define COLOR_ORDER         GRB
#define CHIPSET             WS2812B

// initial matrix layout (to get led strip index by x/y)
#define MATRIX_WIDTH        8
#define MATRIX_HEIGHT       8
#define MATRIX_TYPE         HORIZONTAL_ZIGZAG_MATRIX
#define MATRIX_SIZE         (MATRIX_WIDTH*MATRIX_HEIGHT)
#define NUMPIXELS           MATRIX_SIZE

// create our matrix based on matrix definition
cLEDMatrix<MATRIX_WIDTH, MATRIX_HEIGHT, MATRIX_TYPE> leds;

uint8_t hue;

//DMX

// DMX Adressen
int address_1 = 0;      //definiert die DMX Adresse des Feuers
int address_1_1 = 0;
int address_1_2 = 0;
int address_1_3 = 0;
int address_1_4 = 0;



//Variablen
int Speed = 0;
int counter = 0;
int Aktivierung = 0;
int SAT = 0;
int HELL = 0;

void setup()
{
  //FASTLED
  // initial LEDs
  FastLED.addLeds<CHIPSET, DATA_PIN, COLOR_ORDER>(leds[0], leds.Size()).setCorrection(TypicalSMD5050);
  FastLED.setCorrection(TypicalLEDStrip);
  FastLED.setBrightness(50);
  FastLED.clear(true);
  delay(500);
  FastLED.showColor(CRGB::Red);
  delay(1000);
  FastLED.clear(true);

  hue = 0;

  //DMX Adressenberechnung
  DMXSerial.init(DMXReceiver);
  for(int i = 2; i <=11; i++){
  pinMode(i,INPUT);
  digitalWrite(i, HIGH);
  }
    address_1 = (!digitalRead(2) * 1) + (!digitalRead(3) * 2) + (!digitalRead(4) * 4) + (!digitalRead(5) * 8) + (!digitalRead(7) * 16) + (!digitalRead(8) * 32) + (!digitalRead(9) * 64) + (!digitalRead(10) * 128) + (!digitalRead(11) * 256);
  if(address_1 == 0) {
  address_1 = 1;
  } else if(address_1 > 512){
  address_1 = 512;
  }
  address_1_1 = (address_1 +1);
  address_1_2 = (address_1 +2);
  address_1_3 = (address_1 +3);
  address_1_4 = (address_1 +4);
}


void loop()
{
  //DMX Auswertung
  Aktivierung = DMXSerial.read(address_1);
  Speed = DMXSerial.read(address_1_1);
  SAT = DMXSerial.read(address_1_2);
  HELL = DMXSerial.read(address_1_3);
  hue = DMXSerial.read(address_1_4);


  //Feuer Beleuchtung
  int16_t sx, sy, x, y;
  uint8_t h;

  FastLED.clear();

  h = hue;
 
  if (Aktivierung < 50)
  {
    // ** Fill LED's with diagonal stripes
    for (x=0; x<(leds.Width()+leds.Height()); ++x)
    {
      leds.DrawLine(x - leds.Height(), leds.Height() - 1, x, 0, CHSV(h, SAT, HELL));
      h+=2;
    }
  }
  else
  {
    // ** Fill LED's with horizontal stripes
    for (y=0; y<leds.Height(); ++y)
    {
      leds.DrawLine(0, y, leds.Width() - 1, y, CHSV(h, SAT, HELL));
      h+=2;
    }
  }
  hue+=2;
delay(Speed);
leds.HorizontalMirror();  
leds.QuadrantMirror();
leds.VerticalMirror();
leds.QuadrantRotateMirror();
leds.QuadrantMirror();
leds.TriangleTopMirror();
leds.TriangleBottomMirror();
leds.QuadrantTopTriangleMirror();
leds.QuadrantBottomTriangleMirror();
  FastLED.show();
}

Fehler:

In file included from C:\Users\lucas\OneDrive\88_Arduino\TGN_Feuer\TGN_Feuer.ino:10:0:
C:\Users\lucas\Documents\Arduino\libraries\FastLED/FastLED.h:14:21: note: #pragma message: FastLED version 3.003.003
 #    pragma message "FastLED version 3.003.003"
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
HardwareSerial0.cpp.o (symbol from plugin): In function `Serial':
(.text+0x0): multiple definition of `__vector_18'
libraries\DMXSerial\DMXSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here
HardwareSerial0.cpp.o (symbol from plugin): In function `Serial':
(.text+0x0): multiple definition of `__vector_19'
libraries\DMXSerial\DMXSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
Fehler beim Kompilieren für das Board Arduino Nano.

Bitte markiere Deinen Code in Deinem Post und drücke dann auf das </> Symbol.
Dann markiere Deine Fehlermeldung und drücke ebenfalls auf das </> Symbol.

Dann warte auf Antwort... :wink:

Der Fehler ist offensichtlich!

Dort wird Serial genutzt, und das verursacht den Konflikt!

Und wie Löse ich das Problem?

Eine Möglichkeit:
Indem du die betreffenden Zeilen dort deaktivierst.
Logisch, oder?

Also logisch die stelle zu deaktivieren die das Problem verursacht, nur was muss ich nun in der LEDMatrix.ccp ab ändern:

/*
  LEDMatrix V5 class by Aaron Liddiment (c) 2016
  modified:  Juergen Skrotzky (JorgenVikingGod@gmail.com)
  date:      2016/04/27

  Inspiration for some of the Matrix functions from Stefan Petrick

  FastLED v3.1 library by Daniel Garcia and Mark Kriegsmann.
  Written & tested on a Teensy 3.1 using Arduino V1.6.3 & teensyduino V1.22
*/

#include <FastLED.h>
#include <LEDMatrix.h>


cLEDMatrixBase::cLEDMatrixBase()
{
}

struct CRGB* cLEDMatrixBase::operator[](int n)
{
  return(&m_LED[n]);
}

struct CRGB& cLEDMatrixBase::operator()(int16_t x, int16_t y)
{
  if ( (x >= 0) && (x < m_Width) && (y >= 0) && (y < m_Height))
    return(m_LED[mXY(x, y)]);
  else
    return(m_OutOfBounds);
}

struct CRGB& cLEDMatrixBase::operator()(int16_t i)
{
  if ((i >=0) && (i < (m_Width * m_Height)))
    return(m_LED[i]);
  else
    return(m_OutOfBounds);
}

void cLEDMatrixBase::HorizontalMirror(bool FullHeight)
{
  int ty, y, x, xx;

  if (FullHeight)
    ty = m_Height - 1;
  else
    ty = (m_Height / 2);
  for (y=ty; y>=0; --y)
  {
    for (x=(m_Width/2)-1,xx=((m_Width+1)/2); x>=0; --x,++xx)
      m_LED[mXY(xx, y)] = m_LED[mXY(x, y)];
  }
}


void cLEDMatrixBase::VerticalMirror()
{
  int y, yy, x;

  for (y=(m_Height/2)-1,yy=((m_Height+1)/2); y>=0; --y,++yy)
  {
    for (x=m_Width-1; x>=0; --x)
      m_LED[mXY(x, yy)] = m_LED[mXY(x, y)];
  }
}


void cLEDMatrixBase::QuadrantMirror()
{
  HorizontalMirror(false);
  VerticalMirror();
}


void cLEDMatrixBase::QuadrantRotateMirror()
{
  int MaxXY, MidXY, x, y, src;

  if (m_Width > m_Height)
    MaxXY = m_Height;
  else
    MaxXY = m_Width;
  MidXY = (MaxXY / 2);
  MaxXY--;
  for (x=MidXY-(MaxXY%2); x>=0; --x)
  {
    for (y=MidXY-(MaxXY%2); y>=0; --y)
    {
      src = mXY(x, y);
      m_LED[mXY(MidXY + y, MidXY - (MaxXY % 2) - x)] = m_LED[src];
      m_LED[mXY(MaxXY - x, MaxXY - y)] = m_LED[src];
      m_LED[mXY(MidXY - (MaxXY % 2) - y, MidXY + x)] = m_LED[src];
    }
  }
}


void cLEDMatrixBase::TriangleTopMirror(bool FullHeight)
{
  int MaxXY, x, y;

  if (m_Width > m_Height)
    MaxXY = m_Height - 1;
  else
    MaxXY = m_Width - 1;
  if (! FullHeight)
    MaxXY /= 2;
  for (y=1; y<=MaxXY; ++y)
  {
    for (x=0; x<y; ++x)
      m_LED[mXY(y,x)] = m_LED[mXY(x,y)];
  }
}


void cLEDMatrixBase::TriangleBottomMirror(bool FullHeight)
{
  int MaxXY, x, y, xx, yy;

  if (m_Width > m_Height)
    MaxXY = m_Height - 1;
  else
    MaxXY = m_Width - 1;
  if (! FullHeight)
    MaxXY /= 2;
  for (y=0,xx=MaxXY; y<MaxXY; y++,xx--)
  {
    for (x=MaxXY-y-1,yy=y+1; x>=0; --x,++yy)
      m_LED[mXY(xx, yy)] = m_LED[mXY(x, y)];
  }
}


void cLEDMatrixBase::QuadrantTopTriangleMirror()
{
  TriangleTopMirror(false);
  QuadrantMirror();
}


void cLEDMatrixBase::QuadrantBottomTriangleMirror()
{
  TriangleBottomMirror(false);
  QuadrantMirror();
}

void cLEDMatrixBase::DrawPixel(int16_t x, int16_t y, CRGB Col) {
  DrawLine(x, y, x, y, Col);
}

void cLEDMatrixBase::DrawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, CRGB Col)
{
  int16_t dx = x1 - x0;
  int16_t dy = y1 - y0;
  if (abs(dx) >= abs(dy))
  {
    int32_t y = ((int32_t)y0 << 16) + 32768;
    // Support a single dot line without diving by 0 and crashing below
    if (!dx) {
      (*this)(x0, (y >> 16)) = Col;
    } else {
      int32_t f = ((int32_t)dy << 16) / (int32_t)abs(dx);
      if (dx >= 0)
      {
        for (; x0<=x1; ++x0,y+=f)
          (*this)(x0, (y >> 16)) = Col;
      }
      else
      {
        for (; x0>=x1; --x0,y+=f)
          (*this)(x0, (y >> 16)) = Col;
      }
    }
  }
  else
  {
    int32_t f = ((int32_t)dx << 16) / (int32_t)abs(dy);
    int32_t x = ((int32_t)x0 << 16) + 32768;
    if (dy >= 0)
    {
      for (; y0<=y1; ++y0,x+=f)
        (*this)((x >> 16), y0) = Col;
    }
    else
    {
      for (; y0>=y1; --y0,x+=f)
        (*this)((x >> 16), y0) = Col;
    }
  }
}


void cLEDMatrixBase::DrawRectangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, CRGB Col)
{
  DrawLine(x0, y0, x0, y1, Col);
  DrawLine(x0, y1, x1, y1, Col);
  DrawLine(x1, y1, x1, y0, Col);
  DrawLine(x1, y0, x0, y0, Col);
}


void cLEDMatrixBase::DrawCircle(int16_t xc, int16_t yc, uint16_t r, CRGB Col)
{
  int16_t x = -r;
  int16_t y = 0;
  int16_t e = 2 - (2 * r);
  do
  {
    (*this)(xc + x, yc - y) = Col;
    (*this)(xc - x, yc + y) = Col;
    (*this)(xc + y, yc + x) = Col;
    (*this)(xc - y, yc - x) = Col;
    int16_t _e = e;
    if (_e <= y)
      e += (++y * 2) + 1;
    if ((_e > x) || (e > y))
      e += (++x * 2) + 1;
  }
  while (x < 0);
}


void cLEDMatrixBase::DrawFilledRectangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, CRGB Col)
{
  int16_t y = min(y0, y1);
  for (int16_t c=abs(y1-y0); c>=0; --c,++y)
    DrawLine(x0, y, x1, y, Col);
}


void cLEDMatrixBase::DrawFilledCircle(int16_t xc, int16_t yc, uint16_t r, CRGB Col)
{
  int16_t x = r;
  int16_t y = 0;
  int16_t e = 1 - x;
  while (x >= y)
  {
    DrawLine(xc + x, yc + y, xc - x, yc + y, Col);
    DrawLine(xc + y, yc + x, xc - y, yc + x, Col);
    DrawLine(xc - x, yc - y, xc + x, yc - y, Col);
    DrawLine(xc - y, yc - x, xc + y, yc - x, Col);
    ++y;
    if (e >= 0)
    {
      --x;
      e += 2 * ((y - x) + 1);
    }
    else
      e += (2 * y) + 1;
  }
}

Oder muss ich hier etwas abändern? LEDMatrix.h

/* 
  LEDMatrix V5 class by Aaron Liddiment (c) 2016
  modified:  Juergen Skrotzky (JorgenVikingGod@gmail.com)
  date:      2016/04/27
*/

#ifndef LEDMatrix_h
#define LEDMatrix_h

enum MatrixType_t { HORIZONTAL_MATRIX,
                    VERTICAL_MATRIX,
                    HORIZONTAL_ZIGZAG_MATRIX,
                    VERTICAL_ZIGZAG_MATRIX };

enum BlockType_t	{	HORIZONTAL_BLOCKS,
										VERTICAL_BLOCKS,
										HORIZONTAL_ZIGZAG_BLOCKS,
										VERTICAL_ZIGZAG_BLOCKS };

class cLEDMatrixBase
{
  friend class cSprite;

  protected:
    int16_t m_Width, m_Height;
    struct CRGB *m_LED;
    struct CRGB m_OutOfBounds;

  public:
    cLEDMatrixBase();
    virtual uint32_t mXY(uint16_t x, uint16_t y)=0;
    void SetLEDArray(struct CRGB *pLED);	// Only used with externally defined LED arrays

    struct CRGB *operator[](int n);
    struct CRGB &operator()(int16_t x, int16_t y);
    struct CRGB &operator()(int16_t i);

    int Size()  { return(m_Width * m_Height); }
    int Width() { return(m_Width);  }
    int Height()  { return(m_Height); }

    void HorizontalMirror(bool FullHeight = true);
    void VerticalMirror();
    void QuadrantMirror();
    void QuadrantRotateMirror();
    void TriangleTopMirror(bool FullHeight = true);
    void TriangleBottomMirror(bool FullHeight = true);
    void QuadrantTopTriangleMirror();
    void QuadrantBottomTriangleMirror();

    void DrawPixel(int16_t x, int16_t y, CRGB Col);
    void DrawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, CRGB Col);
    void DrawRectangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, CRGB Col);
    void DrawCircle(int16_t xc, int16_t yc, uint16_t r, CRGB Col);
    void DrawFilledRectangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, CRGB Col);
    void DrawFilledCircle(int16_t xc, int16_t yc, uint16_t r, CRGB Col);
};

template<int16_t tMWidth, int16_t tMHeight, MatrixType_t tMType, int8_t tBWidth = 1, int8_t tBHeight = 1, BlockType_t tBType = HORIZONTAL_BLOCKS> class cLEDMatrix : public cLEDMatrixBase
{
  private:
    static const int16_t m_absMWidth = (tMWidth * ((tMWidth < 0) * -1 + (tMWidth > 0)));
    static const int16_t m_absMHeight = (tMHeight * ((tMHeight < 0) * -1 + (tMHeight > 0)));
    static const int16_t m_absBWidth = (tBWidth * ((tBWidth < 0) * -1 + (tBWidth > 0)));
    static const int16_t m_absBHeight = (tBHeight * ((tBHeight < 0) * -1 + (tBHeight > 0)));
    struct CRGB *p_LED;

  public:
    cLEDMatrix(bool doMalloc=true)
    {
      m_Width = m_absMWidth * m_absBWidth;
      m_Height = m_absMHeight * m_absBHeight;
      if (doMalloc) {
	  // On ESP32, there is more memory available via malloc than static global arrays
          p_LED = (struct CRGB *) malloc(m_absMWidth * m_absBWidth * m_absMHeight * m_absBHeight * sizeof(CRGB));
          m_LED = p_LED;
	  if (! p_LED) {
	     Serial.begin(115200);
	     Serial.println("Malloc LEDMatrix Failed");
	     while (1);
	  }
      } else {
	  Serial.println("LED array not intialized, must be set by SetLEDArray");
      }
    }
    void SetLEDArray(struct CRGB *pLED)
    {
      p_LED = pLED;
      m_LED = pLED;
    }
    virtual uint32_t mXY(uint16_t x, uint16_t y)
    {
			if ((tBWidth == 1) && (tBHeight == 1))
			{
				// No Blocks, just a Matrix
	      if (tMWidth < 0)
	        x = (m_absMWidth - 1) - x;
		    if (tMHeight < 0)
	        y = (m_absMHeight - 1) - y;
	      if (tMType == HORIZONTAL_MATRIX)
	        return((y * m_absMWidth) + x);
	      else if (tMType == VERTICAL_MATRIX)
	        return((x * m_absMHeight) + y);
	      else if (tMType == HORIZONTAL_ZIGZAG_MATRIX)
	      {
	        if (y % 2)
	          return((((y + 1) * m_absMWidth) - 1) - x);
	        else
	          return((y * m_absMWidth) + x);
	      }
	      else /* if (tMType == VERTICAL_ZIGZAG_MATRIX) */
	      {
	        if (x % 2)
	          return((((x + 1) * m_absMHeight) - 1) - y);
	        else
	          return((x * m_absMHeight) + y);
	      }
			}
			else
			{
				// Reverse Block/Matrix X coordinate if needed
				if ((tBWidth < 0) && (tMWidth < 0))
					x = (((m_absBWidth - 1) - (x / m_absMWidth)) * m_absMWidth) + ((m_absMWidth - 1) - (x % m_absMWidth));
				else if (tBWidth < 0)
					x = (((m_absBWidth - 1) - (x / m_absMWidth)) * m_absMWidth) + (x % m_absMWidth);
				else if (tMWidth < 0)
					x = x - ((x % m_absMWidth) * 2) + (m_absMWidth - 1);
				// Reverse Block/Matrix Y coordinate if needed
				if ((tBHeight < 0) && (tMHeight < 0))
					y = (((m_absBHeight - 1) - (y / m_absMHeight)) * m_absMHeight) + ((m_absMHeight - 1) - (y % m_absMHeight));
				else if(tBHeight < 0)
					y = (((m_absBHeight - 1) - (y / m_absMHeight)) * m_absMHeight) + (y % m_absMHeight);
				else if (tMHeight < 0)
					y = y - ((y % m_absMHeight) * 2) + (m_absMHeight - 1);
				// Calculate Block base
	    	uint16_t Base;
		    if (tBType == HORIZONTAL_BLOCKS)
		    	Base = (((y / m_absMHeight) * m_absBWidth) + (x / m_absMWidth)) * (m_absMWidth * m_absMHeight);
		    else if (tBType == VERTICAL_BLOCKS)
		    	Base = (((x / m_absMWidth) * m_absBHeight) + (y / m_absMHeight)) * (m_absMHeight * m_absMWidth);
		    else if (tBType == HORIZONTAL_ZIGZAG_BLOCKS)
		    {
	        if ((y / m_absMHeight) % 2)
			    	Base = (((y / m_absMHeight) * m_absBWidth) + ((m_absBWidth - 1) - (x / m_absMWidth))) * (m_absMWidth * m_absMHeight);
	       	else
			    	Base = (((y / m_absMHeight) * m_absBWidth) + (x / m_absMWidth)) * (m_absMWidth * m_absMHeight);
	      }
	      else /* if (tBType == VERTICAL_ZIGZAG_BLOCKS) */
	      {
	        if ((x / m_absMWidth) % 2)
			    	Base = (((x / m_absMWidth) * m_absBHeight) + ((m_absBHeight - 1) - (y / m_absMHeight))) * (m_absMHeight * m_absMWidth);
	        else
			    	Base = (((x / m_absMWidth) * m_absBHeight) + (y / m_absMHeight)) * (m_absMHeight * m_absMWidth);
	      }
				// Calculate Matrix offset
	      if (tMType == HORIZONTAL_MATRIX)
	        return(Base + ((y % m_absMHeight) * m_absMWidth) + (x % m_absMWidth));
	      else if (tMType == VERTICAL_MATRIX)
	        return(Base + ((x % m_absMWidth) * m_absMHeight) + (y % m_absMHeight));
	      else if (tMType == HORIZONTAL_ZIGZAG_MATRIX)
	      {
	        if ((y % m_absMHeight) % 2)
	          return(Base + ((((y % m_absMHeight) + 1) * m_absMWidth) - 1) - (x % m_absMWidth));
	        else
	          return(Base + ((y % m_absMHeight) * m_absMWidth) + (x % m_absMWidth));
	      }
	      else /* if (tMType == VERTICAL_ZIGZAG_MATRIX) */
	      {
	        if ((x % m_absMWidth) % 2)
	          return(Base + ((((x % m_absMWidth) + 1) * m_absMHeight) - 1) - (y % m_absMHeight));
	        else
	          return(Base + ((x % m_absMWidth) * m_absMHeight) + (y % m_absMHeight));
	      }
	    }
    }

    void ShiftLeft(void)
    {
      if ((tBWidth != 1) || (tBHeight != 1))
     	{
				// Blocks, so no optimisation
		    for (int16_t x=1; x<m_Width; ++x)
  			{
				  for (int16_t y=0; y<m_Height; ++y)
      			m_LED[mXY(x - 1, y)] = m_LED[mXY(x, y)];
			  }
			  for (int16_t y=0; y<m_Height; ++y)
     			m_LED[mXY(m_Width - 1, y)] = CRGB(0, 0, 0);
     	}
     	else
      {
				// No Blocks, just a Matrix so optimise a little
        switch (tMType)
        {
          case HORIZONTAL_MATRIX:
            if (tMWidth > 0)
              HPWSL();
            else
              HNWSL();
            break;
          case VERTICAL_MATRIX:
            if (tMWidth > 0)
              VPWSL();
            else
              VNWSL();
            break;
          case HORIZONTAL_ZIGZAG_MATRIX:
            if (tMWidth > 0)
              HZPWSL();
            else
              HZNWSL();
            break;
          case VERTICAL_ZIGZAG_MATRIX:
            if (tMWidth > 0)
              VZPWSL();
            else
              VZNWSL();
            break;
        }
      }
    }

    void ShiftRight(void)
    {
      if ((tBWidth != 1) || (tBHeight != 1))
     	{
				// Blocks, so no optimisation
		    for (int16_t x=m_Width-1; x>=1; --x)
  			{
				  for (int16_t y=0; y<m_Height; ++y)
      			m_LED[mXY(x, y)] = m_LED[mXY(x - 1, y)];
			  }
			  for (int16_t y=0; y<m_Height; ++y)
     			m_LED[mXY(0, y)] = CRGB(0, 0, 0);
     	}
     	else
      {
				// No Blocks, just a Matrix so optimise a little
        switch (tMType)
        {
          case HORIZONTAL_MATRIX:
            if (tMWidth > 0)
              HNWSL();
            else
              HPWSL();
            break;
          case VERTICAL_MATRIX:
            if (tMWidth > 0)
              VNWSL();
            else
              VPWSL();
            break;
          case HORIZONTAL_ZIGZAG_MATRIX:
            if (tMWidth > 0)
              HZNWSL();
            else
              HZPWSL();
            break;
          case VERTICAL_ZIGZAG_MATRIX:
            if (tMWidth > 0)
              VZNWSL();
            else
              VZPWSL();
            break;
        }
      }
    }

    void ShiftDown(void)
    {
      if ((tBWidth != 1) || (tBHeight != 1))
     	{
				// Blocks, so no optimisation
			  for (int16_t y=1; y<m_Height; ++y)
  			{
			    for (int16_t x=0; x<m_Width; ++x)
      			m_LED[mXY(x, y - 1)] = m_LED[mXY(x, y)];
			  }
		    for (int16_t x=0; x<m_Width; ++x)
     			m_LED[mXY(x, m_Height - 1)] = CRGB(0, 0, 0);
     	}
     	else
      {
				// No Blocks, just a Matrix so optimise a little
        switch (tMType)
        {
          case HORIZONTAL_MATRIX:
            if (tMHeight > 0)
              HPHSD();
            else
              HNHSD();
            break;
          case VERTICAL_MATRIX:
            if (tMHeight > 0)
              VPHSD();
            else
              VNHSD();
            break;
          case HORIZONTAL_ZIGZAG_MATRIX:
            if (tMHeight > 0)
              HZPHSD();
            else
              HZNHSD();
            break;
          case VERTICAL_ZIGZAG_MATRIX:
            if (tMHeight > 0)
              VZPHSD();
            else
              VZNHSD();
            break;
        }
      }
    }

    void ShiftUp(void)
    {
      if ((tBWidth != 1) || (tBHeight != 1))
     	{
				// Blocks, so no optimisation
			  for (int16_t y=m_Height-1; y>=1; --y)
  			{
			    for (int16_t x=0; x<m_Width; ++x)
      			m_LED[mXY(x, y)] = m_LED[mXY(x, y - 1)];
			  }
		    for (int16_t x=0; x<m_Width; ++x)
     			m_LED[mXY(x, 0)] = CRGB(0, 0, 0);
     	}
     	else
      {
				// No Blocks, just a Matrix so optimise a little
        switch (tMType)
        {
          case HORIZONTAL_MATRIX:
          	if (tMHeight > 0)
              HNHSD();
            else
              HPHSD();
            break;
          case VERTICAL_MATRIX:
            if (tMHeight > 0)
              VNHSD();
            else
              VPHSD();
            break;
          case HORIZONTAL_ZIGZAG_MATRIX:
            if (tMHeight > 0)
              HZNHSD();
            else
              HZPHSD();
            break;
          case VERTICAL_ZIGZAG_MATRIX:
            if (tMHeight > 0)
              VZNHSD();
            else
              VZPHSD();
            break;
        }
      }
    }

  private:
  	// Optimised functions used by ShiftLeft & ShiftRight in non block mode
    void HPWSL(void)
    {
      uint32_t i = 0;
      for (int16_t y=m_absMHeight; y>0; --y,++i)
      {
        for (uint16_t x=m_absMWidth-1; x>0; --x,++i)
          p_LED[i] = p_LED[i + 1];
        p_LED[i] = CRGB(0, 0, 0);
      }
    }
    void HNWSL(void)
    {
      uint32_t i = m_absMWidth - 1;
      for (int16_t y=m_absMHeight; y>0; --y)
      {
        for (uint16_t x=m_absMWidth-1; x>0; --x,--i)
          p_LED[i] = p_LED[i - 1];
        p_LED[i] = CRGB(0, 0, 0);
        i += ((m_absMWidth * 2) - 1);
      }
    }
    void VPWSL(void)
    {
      uint32_t i = 0;
      uint32_t j = m_absMHeight;
      for (uint16_t x=m_absMWidth-1; x>0; --x)
      {
        for (int16_t y=m_absMHeight; y>0; --y)
          p_LED[i++] = p_LED[j++];
      }
      for (int16_t y=m_absMHeight; y>0; --y)
        p_LED[i++] = CRGB(0, 0, 0);
    }
    void VNWSL(void)
    {
      uint32_t i = (m_absMHeight * m_absMWidth) - 1;
      uint32_t j = i - m_absMHeight;
      for (uint16_t x=m_absMWidth-1; x>0; --x)
      {
        for (int16_t y=m_absMHeight; y>0; --y)
          p_LED[i--] = p_LED[j--];
      }
      for (int16_t y=m_absMHeight; y>0; --y)
        p_LED[i--] = CRGB(0, 0, 0);
    }
    void HZPWSL(void)
    {
      uint32_t i = 0;
      for (int16_t y=m_absMHeight; y>0; y-=2)
      {
        for (uint16_t x=m_absMWidth-1; x>0; --x,++i)
          p_LED[i] = p_LED[i + 1];
        p_LED[i] = CRGB(0, 0, 0);
        i++;
        if (y > 1)
        {
          i += (m_absMWidth - 1);
          for (uint16_t x=m_absMWidth-1; x>0; --x,--i)
            p_LED[i] = p_LED[i - 1];
          p_LED[i] = CRGB(0, 0, 0);
          i += m_absMWidth;
        }
      }
    }
    void HZNWSL(void)
    {
      uint32_t i = m_absMWidth - 1;
      for (int16_t y=m_absMHeight; y>0; y-=2)
      {
        for (uint16_t x=m_absMWidth-1; x>0; --x,--i)
          p_LED[i] = p_LED[i - 1];
        p_LED[i] = CRGB(0, 0, 0);
        if (y > 1)
        {
          i += m_absMWidth;
          for (uint16_t x=m_absMWidth-1; x>0; --x,++i)
            p_LED[i] = p_LED[i + 1];
          p_LED[i] = CRGB(0, 0, 0);
          i += m_absMWidth;
        }
      }
    }
    void VZPWSL(void)
    {
      uint32_t i = 0;
      uint32_t j = (m_absMHeight * 2) - 1;
      for (uint16_t x=m_absMWidth-1; x>0; x-=2)
      {
        for (int16_t y=m_absMHeight; y>0; --y)
          p_LED[i++] = p_LED[j--];
        if (x > 1)
        {
          j += (m_absMHeight * 2);
          for (int16_t y=m_absMHeight; y>0; --y)
            p_LED[i++] = p_LED[j--];
          j += (m_absMHeight * 2);
        }
      }
      for (int16_t y=m_absMHeight; y>0; y--)
        p_LED[i++] = CRGB(0, 0, 0);
    }
    void VZNWSL(void)
    {
      uint32_t i = (m_absMHeight * m_absMWidth) - 1;
      uint32_t j = m_absMHeight * (m_absMWidth - 2);
      for (uint16_t x=m_absMWidth-1; x>0; x-=2)
      {
        for (int16_t y=m_absMHeight; y>0; --y)
          p_LED[i--] = p_LED[j++];
        if (x > 1)
        {
          j -= (m_absMHeight * 2);
          for (int16_t y=m_absMHeight; y>0; --y)
            p_LED[i--] = p_LED[j++];
          j -= (m_absMHeight * 2);
        }
      }
      for (int16_t y=m_absMHeight; y>0; y--)
        p_LED[i--] = CRGB(0, 0, 0);
    }

  	// Optimised functions used by ShiftDown & ShiftUp in non block mode
    void HPHSD(void)
    {
      uint32_t i = 0;
      uint32_t j = m_absMWidth;
      for (uint16_t y=m_absMHeight-1; y>0; --y)
      {
        for (uint16_t x=m_absMWidth; x>0; --x)
          p_LED[i++] = p_LED[j++];
      }
      for (uint16_t x=m_absMWidth; x>0; --x)
        p_LED[i++] = CRGB(0, 0, 0);
    }
    void HNHSD(void)
    {
      uint32_t i = (m_absMWidth * m_absMHeight) - 1;
      uint32_t j = i - m_absMWidth;
      for (uint16_t y=m_absMHeight-1; y>0; --y)
      {
        for (uint16_t x=m_absMWidth; x>0; --x)
          p_LED[i--] = p_LED[j--];
      }
      for (uint16_t x=m_absMWidth; x>0; --x)
        p_LED[i--] = CRGB(0, 0, 0);
    }
    void VPHSD(void)
    {
      uint32_t i = 0;
      for (uint16_t x=m_absMWidth; x>0; --x,++i)
      {
        for (uint16_t y=m_absMHeight-1; y>0; --y,++i)
          p_LED[i] = p_LED[i + 1];
        p_LED[i] = CRGB(0, 0, 0);
      }
    }
    void VNHSD(void)
    {
      uint32_t i = m_absMHeight - 1;
      for (uint16_t x=m_absMWidth; x>0; --x)
      {
        for (uint16_t y=m_absMHeight-1; y>0; --y,--i)
          p_LED[i] = p_LED[i - 1];
        p_LED[i] = CRGB(0, 0, 0);
        i += ((m_absMHeight * 2) - 1);
      }
    }
    void HZPHSD(void)
    {
      uint32_t i = 0;
      uint32_t j = (m_absMWidth * 2) - 1;
      for (uint16_t y=m_absMHeight-1; y>0; y-=2)
      {
        for (uint16_t x=m_absMWidth; x>0; --x)
          p_LED[i++] = p_LED[j--];
        if (y > 1)
        {
          j += (m_absMWidth * 2);
          for (uint16_t x=m_absMWidth; x>0; --x)
            p_LED[i++] = p_LED[j--];
          j += (m_absMWidth * 2);
        }
      }
      for (uint16_t x=m_absMWidth; x>0; x--)
        p_LED[i++] = CRGB(0, 0, 0);
    }
    void HZNHSD(void)
    {
      uint32_t i = (m_absMWidth * m_absMHeight) - 1;
      uint32_t j = m_absMWidth * (m_absMHeight - 2);
      for (uint16_t y=m_absMHeight-1; y>0; y-=2)
      {
        for (uint16_t x=m_absMWidth; x>0; --x)
          p_LED[i--] = p_LED[j++];
        if (y > 1)
        {
          j -= (m_absMWidth * 2);
          for (uint16_t x=m_absMWidth; x>0; --x)
            p_LED[i--] = p_LED[j++];
          j -= (m_absMWidth * 2);
        }
      }
      for (uint16_t x=m_absMWidth; x>0; x--)
        p_LED[i--] = CRGB(0, 0, 0);
    }
    void VZPHSD(void)
    {
      uint32_t i = 0;
      for (uint16_t x=m_absMWidth; x>0; x-=2)
      {
        for (uint16_t y=m_absMHeight-1; y>0; --y,++i)
          p_LED[i] = p_LED[i + 1];
        p_LED[i] = CRGB(0, 0, 0);
        i++;
        if (x > 1)
        {
          i += (m_absMHeight - 1);
          for (uint16_t y=m_absMHeight-1; y>0; --y,--i)
            p_LED[i] = p_LED[i - 1];
          p_LED[i] = CRGB(0, 0, 0);
          i += m_absMHeight;
        }
      }
    }
    void VZNHSD(void)
    {
      uint32_t i = m_absMHeight - 1;
      for (uint16_t x=m_absMWidth; x>0; x-=2)
      {
        for (uint16_t y=m_absMHeight-1; y>0; --y,--i)
          p_LED[i] = p_LED[i - 1];
        p_LED[i] = CRGB(0, 0, 0);
        if (x > 1)
        {
          i += m_absMHeight;
          for (uint16_t y=m_absMHeight-1; y>0; --y,++i)
            p_LED[i] = p_LED[i + 1];
          p_LED[i] = CRGB(0, 0, 0);
          i += m_absMHeight;
        }
      }
    }

};

#endif

das steht tatsächlich so im Original drin...
Upps.

Gut!
An der Stelle herrscht Einigkeit!?!

Kommt darin Serial vor? Nein!
Gibts dann darin was zu ändern? Nein!

Ich meine mich zu erinnern,, warte... ich schaue mal nach... ok, ich hatte LEDMatrix.h geschrieben/zitiert.
Und auch LEDMatrix.h gemeint.
Also ja!

Danke Euch für eure Hilfe =) Bin nun auch schlauer. :rofl:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.