Allow chain of 1-4 panels - subject to memory
This commit is contained in:
@@ -466,6 +466,8 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh
|
|||||||
|
|
||||||
mxconfig.double_buff = false; // <------------- Turn on double buffer
|
mxconfig.double_buff = false; // <------------- Turn on double buffer
|
||||||
|
|
||||||
|
mxconfig.chain_length = max((u_int8_t) 1, min(bc.pins[0], (u_int8_t) 4)); // prevent bad data preventing boot due to low memory
|
||||||
|
|
||||||
fourScanPanel = nullptr;
|
fourScanPanel = nullptr;
|
||||||
|
|
||||||
switch(bc.type) {
|
switch(bc.type) {
|
||||||
@@ -566,24 +568,11 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
USER_PRINTLN("MatrixPanel_I2S_DMA config");
|
USER_PRINTF("MatrixPanel_I2S_DMA config - %ux%u length: %u\n", mxconfig.mx_width, mxconfig.mx_height, mxconfig.chain_length);
|
||||||
|
|
||||||
// OK, now we can create our matrix object
|
// OK, now we can create our matrix object
|
||||||
display = new MatrixPanel_I2S_DMA(mxconfig);
|
display = new MatrixPanel_I2S_DMA(mxconfig);
|
||||||
|
|
||||||
switch(bc.type) {
|
|
||||||
case 105:
|
|
||||||
USER_PRINTLN("MatrixPanel_I2S_DMA FOUR_SCAN_16PX_HIGH");
|
|
||||||
fourScanPanel = new VirtualMatrixPanel((*display), 1, 1, 32, 32);
|
|
||||||
fourScanPanel->setPhysicalPanelScanRate(FOUR_SCAN_16PX_HIGH);
|
|
||||||
break;
|
|
||||||
case 106:
|
|
||||||
USER_PRINTLN("MatrixPanel_I2S_DMA FOUR_SCAN_32PX_HIGH");
|
|
||||||
fourScanPanel = new VirtualMatrixPanel((*display), 1, 1, 64, 64);
|
|
||||||
fourScanPanel->setPhysicalPanelScanRate(FOUR_SCAN_32PX_HIGH);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->_len = (display->width() * display->height());
|
this->_len = (display->width() * display->height());
|
||||||
|
|
||||||
pinManager.allocatePin(mxconfig.gpio.r1, true, PinOwner::HUB75);
|
pinManager.allocatePin(mxconfig.gpio.r1, true, PinOwner::HUB75);
|
||||||
@@ -611,11 +600,28 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh
|
|||||||
|
|
||||||
// Allocate memory and start DMA display
|
// Allocate memory and start DMA display
|
||||||
if( not display->begin() ) {
|
if( not display->begin() ) {
|
||||||
USER_PRINTLN("****** !KABOOM! I2S memory allocation failed ***********");
|
USER_PRINTLN("****** MatrixPanel_I2S_DMA !KABOOM! I2S memory allocation failed ***********");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_valid = true;
|
_valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch(bc.type) {
|
||||||
|
case 105:
|
||||||
|
USER_PRINTLN("MatrixPanel_I2S_DMA FOUR_SCAN_32PX_HIGH");
|
||||||
|
fourScanPanel = new VirtualMatrixPanel((*display), 1, 1, 32, 32);
|
||||||
|
fourScanPanel->setPhysicalPanelScanRate(FOUR_SCAN_32PX_HIGH);
|
||||||
|
fourScanPanel->setRotation(0);
|
||||||
|
break;
|
||||||
|
case 106:
|
||||||
|
USER_PRINTLN("MatrixPanel_I2S_DMA FOUR_SCAN_64PX_HIGH");
|
||||||
|
fourScanPanel = new VirtualMatrixPanel((*display), 1, 1, 64, 64);
|
||||||
|
fourScanPanel->setPhysicalPanelScanRate(FOUR_SCAN_64PX_HIGH);
|
||||||
|
fourScanPanel->setRotation(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
USER_PRINTLN("MatrixPanel_I2S_DMA started");
|
USER_PRINTLN("MatrixPanel_I2S_DMA started");
|
||||||
}
|
}
|
||||||
@@ -624,12 +630,14 @@ void BusHub75Matrix::setPixelColor(uint16_t pix, uint32_t c) {
|
|||||||
r = R(c);
|
r = R(c);
|
||||||
g = G(c);
|
g = G(c);
|
||||||
b = B(c);
|
b = B(c);
|
||||||
x = pix % mxconfig.mx_width;
|
|
||||||
y = floor(pix / mxconfig.mx_width);
|
|
||||||
if(fourScanPanel != nullptr) {
|
if(fourScanPanel != nullptr) {
|
||||||
|
x = pix % fourScanPanel->width();
|
||||||
|
y = floor(pix / fourScanPanel->width());
|
||||||
fourScanPanel->drawPixelRGB888(x, y, r, g, b);
|
fourScanPanel->drawPixelRGB888(x, y, r, g, b);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
x = pix % display->width();
|
||||||
|
y = floor(pix / display->width());
|
||||||
display->drawPixelRGB888(x, y, r, g, b);
|
display->drawPixelRGB888(x, y, r, g, b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -350,7 +350,10 @@ class BusHub75Matrix : public Bus {
|
|||||||
|
|
||||||
void setBrightness(uint8_t b, bool immediate);
|
void setBrightness(uint8_t b, bool immediate);
|
||||||
|
|
||||||
uint8_t getPins(uint8_t* pinArray) { return 1; } // Fake value due to keep finaliseInit happy
|
uint8_t getPins(uint8_t* pinArray) {
|
||||||
|
pinArray[0] = mxconfig.chain_length;
|
||||||
|
return 1;
|
||||||
|
} // Fake value due to keep finaliseInit happy
|
||||||
|
|
||||||
void deallocatePins();
|
void deallocatePins();
|
||||||
|
|
||||||
|
|||||||
@@ -177,19 +177,12 @@
|
|||||||
if (s[i].name.substring(0,2)=="LT") {
|
if (s[i].name.substring(0,2)=="LT") {
|
||||||
var n = s[i].name.substring(2);
|
var n = s[i].name.substring(2);
|
||||||
var t = parseInt(s[i].value,10);
|
var t = parseInt(s[i].value,10);
|
||||||
gId("p0d"+n).innerHTML = (t>=80 && t<96) ? "IP address:" : (t > 49) ? "Data GPIO:" : (t > 41) ? "GPIOs:" : "GPIO:";
|
gId("p0d"+n).innerHTML = (t >= 100 && t < 110) ? "Chain Length:" : (t>=80 && t<96) ? "IP address:" : (t > 49) ? "Data GPIO:" : (t > 41) ? "GPIOs:" : "GPIO:";
|
||||||
gId("p1d"+n).innerHTML = (t> 49 && t<64) ? "Clk GPIO:" : "";
|
gId("p1d"+n).innerHTML = (t> 49 && t<64) ? "Clk GPIO:" : "";
|
||||||
var LK = d.getElementsByName("L1"+n)[0]; // clock pin
|
var LK = d.getElementsByName("L1"+n)[0]; // clock pin
|
||||||
|
|
||||||
memu += getMem(t, n); // calc memory
|
memu += getMem(t, n); // calc memory
|
||||||
|
|
||||||
if(t >= 100 && t < 110) {
|
|
||||||
var LK = d.getElementsByName("L00")[0]; // data pin
|
|
||||||
LK.style.display = "none";
|
|
||||||
LK.required = false;
|
|
||||||
LK.value="";
|
|
||||||
}
|
|
||||||
|
|
||||||
// enumerate pins
|
// enumerate pins
|
||||||
for (p=1; p<5; p++) {
|
for (p=1; p<5; p++) {
|
||||||
var LK = d.getElementsByName("L"+p+n)[0]; // secondary pins
|
var LK = d.getElementsByName("L"+p+n)[0]; // secondary pins
|
||||||
|
|||||||
Reference in New Issue
Block a user