It isn’t simply a matter of two of the data lines being swapped as I tested every combination of A, B, C, D. The panels are clearly wired incorrectly. How did these make it through quality control?
/* Simple test sketch to evaluate RGB LED Matrix Panels with an ESP32.
* This sketch was developed because I received several 32x64 panels that
* are miswired and I was curious if some of the A, B, C, D lines were
* swapped and could potentially still be used with wiring and/or code changes.
* written by dcamp 2023JAN10
*/
#include <RGBmatrixPanel.h>
// default pin mapping the ESP32_HUB75_LED_MATRIX_PANEL_DMA_Display
//#define R1 25
//#define G1 26
//#define B1 27
//#define R2 14
//#define G2 12
//#define B2 13
//#define A 23
//#define B 19
//#define C 5
//#define D 17
//#define E -1
//#define CLK 16
//#define OE 15
//#define LAT 4
//some variables
int red=0;
int green=0;
int blue=0;
int start=0;
/* There are a total of 4! (24) permutations of A, B, C, D. We're going
* to test every one of them in this sketch. Doesn't that sound like fun?
*/
int ABCD[24][4] = {
// {A, B, C, D}
{23, 19, 5, 17},
{23, 19, 17, 5},
{23, 5, 19, 17},
{23, 5, 17, 19},
{23, 17, 19, 5},
{23, 17, 5, 19},
{19, 23, 5, 17},
{19, 23, 17, 5},
{19, 5, 23, 17},
{19, 5, 17, 23},
{19, 17, 23, 5},
{19, 17, 5, 23},
{ 5, 23, 19, 17},
{ 5, 23, 17, 19},
{ 5, 19, 23, 17},
{ 5, 19, 17, 23},
{ 5, 17, 23, 19},
{ 5, 17, 19, 23},
{17, 23, 19, 5},
{17, 23, 5, 19},
{17, 19, 23, 5},
{17, 19, 5, 23},
{17, 5, 23, 19},
{17, 5, 19, 23}
};
/* each row of pixels in an 8 row block will be the same color so we
* will define 8 colors to use */
int myColors[8][3] = {
// {red, green, blue}
{7, 0, 0},
{0, 7, 0},
{0, 0, 7},
{3, 3, 3},
{7, 7, 0},
{7, 0, 7},
{0, 7, 7},
{7, 7, 7}
};
void setup() {
Serial.begin(115200);
delay(500);
Serial.println("Starting Test...");
for (int i=0; i<24; i++) { //for each permutation, configure RGBMatrixPanel
start = millis();
RGBmatrixPanel matrix(ABCD[i][0], ABCD[i][1], ABCD[i][2], ABCD[i][3], CLK, LAT, OE, true, 64);
matrix.begin();
Serial.println();
Serial.print("Permutation(");
Serial.print(i);
Serial.print("): A=");
Serial.print(ABCD[i][0]);
Serial.print(", B=");
Serial.print(ABCD[i][1]);
Serial.print(", C=");
Serial.print(ABCD[i][2]);
Serial.print(", D=");
Serial.println(ABCD[i][3]);
/* Draw one pixel at a time across the width of the panel starting in the
* top left at pixel 0,0. Work horizontally across the panel to pixel 0,63
* then move down one row to pixel 1,0 -> 1,63. Repeat until we get to 31,63. */
for (int y=0; y<32; y++) {
int rowidx=y%8;
red = myColors[rowidx][0];
green = myColors[rowidx][1];
blue = myColors[rowidx][2];
Serial.print("Row ");
Serial.print(y);
Serial.print(", Color ");
Serial.println(rowidx);
for (int x=0; x<64; x++) {
matrix.drawPixel(x, y, matrix.Color333(red, green, blue));
delay(1);
} // end for x
} // end for y
Serial.print("Completed in ");
Serial.print(millis() - start);
Serial.println(" mS");
} // end for i
}
void loop() {
//nothing to see here
}