hzeller / rpi-rgb-led-matrix

Controlling up to three chains of 64x64, 32x32, 16x32 or similar RGB LED displays using Raspberry Pi GPIO
GNU General Public License v2.0
3.7k stars 1.17k forks source link

P5 8S 64x32 Outdoor (510T-2212) Panel - Multiplex Mapper #1543

Open briggsm opened 1 year ago

briggsm commented 1 year ago

I found a panel that none of the Multiplex options (0-18) worked for, so I had to create a new one for it in multiplex-mappers.cc.

I don't really have a deep understanding of what I'm doing, but I managed to get it working. I want to document it here, so others might benefit, and I'd like to create a pull-request to have it added to this library.

Here's the code I added to multiplex-mappers.cc:

class P5Outdoor8S64x32MultiplexMapper : public MultiplexMapperBase
{
public:
  P5Outdoor8S64x32MultiplexMapper() : MultiplexMapperBase("P5Outdoor8S64x32", 2) {}

  void MapSinglePanel(int x, int y, int *matrix_x, int *matrix_y) const
  {
    // *matrix_y = 0;   // Change between 0 to 15!
    // *matrix_x = 0; // Change between 0 to 127!

    if (y >= 0 && y < 8) {
      *matrix_y = y;
    } else if (y >= 8 && y < 16) {
      *matrix_y = y - 8;
    } else if (y >= 16 && y < 24) {
      *matrix_y = y - 8;
    } else if (y >= 24 && y < 32) {
      *matrix_y = y - 16;
    }

    int incrFactor = x / 4;
    if ((y >= 0 && y < 8) || (y >= 16 && y < 24)) {
      *matrix_x = x + (incrFactor * 4) + 4;
    } else if ((y >= 8 && y < 16) || (y >= 24 && y < 32)) {
      *matrix_x = x + (incrFactor * 4);
    }
  }
};

static MuxMapperList *CreateMultiplexMapperList()
{
  MuxMapperList *result = new MuxMapperList();

  // Here, register all multiplex mappers from above.
  .
  .
  .
  result->push_back(new P5Outdoor8S64x32MultiplexMapper());
  return result;
}

This panel uses a 'Row Address Type' of 0: --led-row-addr-type=0

So the configuration options that I use are: --led-cols=64 --led-rows=32 --led-row-addr-type=0 --led-multiplexing=19 --led-slowdown-gpio=2 led-multiplexing of 19: The Multiplex Mapper I specified in this post. led-slowdown-gpio of 2: sometimes needs to be 3 depending on the quality of my power supply / power cable!

To figure out the multiplexing code, I setup a spreadsheet, so I could see the pattern, then figure out the right math that would map the pixels correctly. (Anybody, please feel free to simplify my math if it can be - or make it perform better). Here is an image of the spreadsheet that shows how the pixels are mapped on my panel:

image

Out of curiosity, does anybody know what this type of mapping is called? (stripe, zstripe, checkered, spiral, etc.) I have no idea - looks really weird to me. Must be for speed or brightness, I guess.

Also for reference, here's a picture of the back of my panel: 64x32 P5 S8 Panel Back

What other info can I give to help distinguish this panel from other similar panels?

veryslow commented 1 year ago

Hi, I just discover your post, and I guess I fighted with the same kind of outdoor panels from Eagerled (P5-O8S-SMD2727-64x32). I wrote a mapping in an algebric way, if it helps :

void MapSinglePanel(int x, int y, int *matrix_x, int *matrix_y) const {
    int pix_nb = x+(y*64);
    *matrix_x = ((((pix_nb%64)/4)+1)*8)-((((pix_nb%1024)/512)+1)*4)+(pix_nb%4);
    *matrix_y = ((pix_nb/64)%8)+((pix_nb/1024)*8);

cheers, fabrice.