diff options
| author | mrfaptastic <12006953+mrfaptastic@users.noreply.github.com> | 2023-03-17 15:13:06 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-17 15:13:06 +0000 |
| commit | 264d997618b776f1bb078bd882d53c2ec556c0db (patch) | |
| tree | d5ca1710748c741b8ff476b6e7a2b5b28bab176b | |
| parent | e34087e98bef60d28a7160836fa69481570b096b (diff) | |
| parent | 817d81edaed1ae493ad19c78d3b38f4570c2482c (diff) | |
Merge pull request #420 from drvkmr/master
Serpent-less arrangements added
| -rw-r--r-- | src/ESP32-VirtualMatrixPanel-I2S-DMA.h | 87 |
1 files changed, 46 insertions, 41 deletions
diff --git a/src/ESP32-VirtualMatrixPanel-I2S-DMA.h b/src/ESP32-VirtualMatrixPanel-I2S-DMA.h index cfa295b..6e973b0 100644 --- a/src/ESP32-VirtualMatrixPanel-I2S-DMA.h +++ b/src/ESP32-VirtualMatrixPanel-I2S-DMA.h @@ -58,8 +58,10 @@ enum PANEL_CHAIN_TYPE CHAIN_TOP_RIGHT_DOWN, CHAIN_BOTTOM_LEFT_UP, CHAIN_BOTTOM_RIGHT_UP, - CHAIN_TOP_RIGHT_DOWN_ZZ, /// ZigZag chaining. Might need a big ass cable to do this, all panels right way up. - CHAIN_BOTTOM_RIGHT_UP_ZZ + CHAIN_TOP_LEFT_DOWN_ZZ, /// ZigZag chaining. Might need a big ass cable to do this, all panels right way up. + CHAIN_TOP_RIGHT_DOWN_ZZ, + CHAIN_BOTTOM_RIGHT_UP_ZZ, + CHAIN_BOTTOM_LEFT_UP_ZZ }; #ifdef USE_GFX_ROOT @@ -177,7 +179,6 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &virt_x, int16_t &vir int row = (virt_y / panelResY); // 0 indexed switch(panel_chain_type) { - case (CHAIN_TOP_RIGHT_DOWN): { if ( (row % 2) == 1 ) @@ -185,53 +186,62 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &virt_x, int16_t &vir //Serial.printf("Condition 1, row %d ", row); - // refersed for the row + // reversed for the row coords.x = dmaResX - virt_x - (row*virtualResX); // y co-ord inverted within the panel - coords.y = panelResY - 1 - (virt_y % panelResY); - - + coords.y = panelResY - 1 - (virt_y % panelResY); } else { //Serial.printf("Condition 2, row %d ", row); - coords.x = ((vmodule_rows - (row+1))*virtualResX)+virt_x; - coords.y = virt_y % panelResY; - + coords.y = virt_y % panelResY; } } - break; + break; + case (CHAIN_TOP_RIGHT_DOWN_ZZ): + { + // Right side up. Starting from top right all the way down. + // Connected in a Zig Zag manner = some long ass cables being used potentially + + //Serial.printf("Condition 2, row %d ", row); + coords.x = ((vmodule_rows - (row+1))*virtualResX)+virt_x; + coords.y = virt_y % panelResY; + } + break; case (CHAIN_TOP_LEFT_DOWN): // OK -> modulus opposite of CHAIN_TOP_RIGHT_DOWN { if ( (row % 2) == 0 ) - { // refersed panel + { // reversed panel //Serial.printf("Condition 1, row %d ", row); coords.x = dmaResX - virt_x - (row*virtualResX); // y co-ord inverted within the panel - coords.y = panelResY - 1 - (virt_y % panelResY); - + coords.y = panelResY - 1 - (virt_y % panelResY); } else { //Serial.printf("Condition 2, row %d ", row); coords.x = ((vmodule_rows - (row+1))*virtualResX)+virt_x; coords.y = virt_y % panelResY; - } - } - break; + break; + + case (CHAIN_TOP_LEFT_DOWN_ZZ): + { + //Serial.printf("Condition 2, row %d ", row); + coords.x = ((vmodule_rows - (row+1))*virtualResX)+virt_x; + coords.y = virt_y % panelResY; + } + break; - - case (CHAIN_BOTTOM_LEFT_UP): // { row = vmodule_rows - row - 1; @@ -241,7 +251,6 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &virt_x, int16_t &vir // Serial.printf("Condition 1, row %d ", row); coords.x = ((vmodule_rows - (row+1))*virtualResX)+virt_x; coords.y = virt_y % panelResY; - } else { // inverted panel @@ -252,7 +261,16 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &virt_x, int16_t &vir } } - break; + break; + + case (CHAIN_BOTTOM_LEFT_UP_ZZ): // + { + row = vmodule_rows - row - 1; + // Serial.printf("Condition 1, row %d ", row); + coords.x = ((vmodule_rows - (row+1))*virtualResX)+virt_x; + coords.y = virt_y % panelResY; + } + break; case (CHAIN_BOTTOM_RIGHT_UP): // OK -> modulus opposite of CHAIN_BOTTOM_LEFT_UP { @@ -265,7 +283,6 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &virt_x, int16_t &vir // refersed for the row coords.x = ((vmodule_rows - (row+1))*virtualResX)+virt_x; coords.y = virt_y % panelResY; - } else { // inverted panel @@ -276,36 +293,24 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &virt_x, int16_t &vir } } - break; - - - case CHAIN_TOP_RIGHT_DOWN_ZZ: - { - // Right side up. Starting from top right all the way down. - // Connected in a Zig Zag manner = some long ass cables being used potentially - - //Serial.printf("Condition 2, row %d ", row); - coords.x = ((vmodule_rows - (row+1))*virtualResX)+virt_x; - coords.y = virt_y % panelResY; + break; - } - - case CHAIN_BOTTOM_RIGHT_UP_ZZ: + case (CHAIN_BOTTOM_RIGHT_UP_ZZ): { // Right side up. Starting bottom right all the way up. // Connected in a Zig Zag manner = some long ass cables being used potentially + row = vmodule_rows - row - 1; //Serial.printf("Condition 2, row %d ", row); - coords.x = (row*virtualResX)+virt_x; - coords.y = virt_y % panelResY; - + coords.x = ((vmodule_rows - (row+1))*virtualResX)+virt_x; + coords.y = virt_y % panelResY; } + break; - default: coords.x = coords.y = -1; // By defalt use an invalid co-ordinates that will be rejected by updateMatrixDMABuffer return coords; - break; + break; } // end switch |
