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_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_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
@ -280,7 +281,7 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &virt_x, int16_t &vir
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
//Serial.printf("Condition 2, row %d ", row);
@ -288,9 +289,18 @@ inline VirtualCoords VirtualMatrixPanel::getCoords(int16_t &virt_x, int16_t &vir
coords.y = virt_y % panelResY;
}
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:
coords.x = coords.y = -1; // By defalt use an invalid co-ordinates that will be rejected by updateMatrixDMABuffer

View file

@ -29,7 +29,8 @@ 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_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
};
@ -262,6 +263,18 @@ inline VirtualCoords VirtualMatrixPanelTest::getCoords_Dev(int16_t virt_x, int16
coords.y = virt_y % panelResY;
}
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;
}
@ -425,6 +438,19 @@ main(int argc, char* argv[])
result = test.getCoords_Dev(16,64*2-1);
expected.x = 80; expected.y = 63;
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";