Add ZigZag options. Close #414

CHAIN_BOTTOM_RIGHT_UP_ZZ
CHAIN_TOP_RIGHT_DOWN_ZZ
This commit is contained in:
mrfaptastic 2023-03-15 14:05:18 +00:00
parent 1d21b165df
commit fe5d414825
2 changed files with 42 additions and 6 deletions

View file

@ -58,7 +58,8 @@ enum PANEL_CHAIN_TYPE
CHAIN_TOP_RIGHT_DOWN, CHAIN_TOP_RIGHT_DOWN,
CHAIN_BOTTOM_LEFT_UP, CHAIN_BOTTOM_LEFT_UP,
CHAIN_BOTTOM_RIGHT_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_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
}; };
#ifdef USE_GFX_ROOT #ifdef USE_GFX_ROOT
@ -280,7 +281,7 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &virt_x, int16_t &vir
case CHAIN_TOP_RIGHT_DOWN_ZZ: case CHAIN_TOP_RIGHT_DOWN_ZZ:
{ {
// Right side up. Starting from top left all the way down. // Right side up. Starting from top right all the way down.
// Connected in a Zig Zag manner = some long ass cables being used potentially // Connected in a Zig Zag manner = some long ass cables being used potentially
//Serial.printf("Condition 2, row %d ", row); //Serial.printf("Condition 2, row %d ", row);
@ -289,7 +290,16 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &virt_x, int16_t &vir
} }
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
//Serial.printf("Condition 2, row %d ", row);
coords.x = (row*virtualResX)+virt_x;
coords.y = virt_y % panelResY;
}
default: default:

View file

@ -29,7 +29,8 @@ enum PANEL_CHAIN_TYPE
CHAIN_TOP_RIGHT_DOWN, CHAIN_TOP_RIGHT_DOWN,
CHAIN_BOTTOM_LEFT_UP, CHAIN_BOTTOM_LEFT_UP,
CHAIN_BOTTOM_RIGHT_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_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
}; };
@ -263,6 +264,18 @@ inline VirtualCoords VirtualMatrixPanelTest::getCoords_Dev(int16_t virt_x, int16
} }
case CHAIN_BOTTOM_RIGHT_UP_ZZ:
{
// Right side up. Starting from top left 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 = (row*virtualResX)+virt_x;
coords.y = virt_y % panelResY;
}
default: default:
@ -427,6 +440,19 @@ main(int argc, char* argv[])
std::printf("Expected physical (%d, %d) got (%d, %d).\n", expected.x, expected.y, result.x, result.y); std::printf("Expected physical (%d, %d) got (%d, %d).\n", expected.x, expected.y, result.x, result.y);
// CHAIN_BOTTOM_RIGHT_UP_ZZ test 4
result = test.getCoords_Dev(0,0);
expected.x = 0; expected.y = 0;
std::printf("Expected physical (%d, %d) got (%d, %d).\n", expected.x, expected.y, result.x, result.y);
// CHAIN_BOTTOM_RIGHT_UP_ZZ test 4
result = test.getCoords_Dev(63,64);
expected.x = 64*2-1; expected.y = 0;
std::printf("Expected physical (%d, %d) got (%d, %d).\n", expected.x, expected.y, result.x, result.y);
std::cout << "\n\n"; std::cout << "\n\n";
return 0; return 0;