Arbitrary panel order

I am looking into implementing a flexible way of handling panels wired up in any pattern.

To save on cabling I wired up a matrix in a funny pattern and was thinking of changing their order in software. The matrix is made of 2 rows of 8 panels, 32x16pixels.

This would be the logical order in software.

[00][01][02][03][04][05][06][07]
[08][09][10][11][12][13][14][15]

The wiring pattern which minimizes the number of custom cables, favouring the short one that come with a panel, looks like this. (i opt against c-stacking, im keen on all leds facing the same way)

[00][01][06][07][08][09][14][15]
[02][03][04][05][10][11][12][13]

Seems like a arbitrary panel order feature should be not too hard to implement, and that loadMatrixBuffers in CalcImpl would be the place. But after taking a closer look it seems like it mostly
deals with Y coordinates and that the X coordinate is dealt with in fillRefreshRows in LayerImpl.

At first I thought of just doing a XY lookup table, but that dosent work for text rendered by SmartMatrix. Then I thought of doing some memcpy because my brain keeps lumping the data of a panel into one chunk, and not thinking about the rows being the chunks. But there is a pixel per pixel copy operation, which makes me think this feature should not be too hard.

Would a feature where people can specify the order of the panels be needed? Or am I barking up the wrong tree and should just suck it up and have half my p10 matrices upside down?

I am happy to keep digging on this but could use some advice.

I think it’s possible in theory, but I’m not sure what a usable API might look like to allow arbitrary ordering …

Have you considered turning all your panels 90 degrees and stacking them in one row of 16?

Good point on rotating panels 90deg!
API could be passing a array with panel ID and maybe orientation. Seems like I might have to re-wire the thing for now.

Not quite the answer you want, but rpi-rgb-panel has a function to allow you to do arbitrary mappings: https://github.com/hzeller/rpi-rgb-led-matrix/pull/1014 for an example

Also, you probably care about display size and/or re-using existing panels, but you can get 128x64 resolution with a single panel, taking your wiring issues away :slight_smile: