Add 8S and 16S, 1/8 ad 1/16 support

This commit is contained in:
Will Tatam
2024-02-24 11:30:22 +00:00
parent 3b1f408b25
commit 26de408626
4 changed files with 39 additions and 2 deletions

View File

@@ -2306,3 +2306,4 @@ build_flags = ${common.build_flags} ${esp32s3.build_flags} -Wno-misleading-inden
lib_deps = ${esp32_4MB_V4_S_base.esp32_lib_deps}
${common_mm.animartrix_lib_deps}
lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
monitor_filters = esp32_exception_decoder

View File

@@ -465,6 +465,9 @@ void BusNetwork::cleanup() {
BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWhite) {
mxconfig.double_buff = false; // <------------- Turn on double buffer
fourScanPanel = nullptr;
switch(bc.type) {
case 101:
mxconfig.mx_width = 32;
@@ -478,6 +481,14 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh
mxconfig.mx_width = 64;
mxconfig.mx_height = 64;
break;
case 105:
mxconfig.mx_width = 32 * 2;
mxconfig.mx_height = 32 / 2;
break;
case 106:
mxconfig.mx_width = 64 * 2;
mxconfig.mx_height = 64 / 2;
break;
}
// mxconfig.driver = HUB75_I2S_CFG::SHIFTREG;
@@ -554,13 +565,27 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh
#endif
this->_len = (mxconfig.mx_width * mxconfig.mx_height);
USER_PRINTLN("MatrixPanel_I2S_DMA config");
// OK, now we can create our matrix object
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());
pinManager.allocatePin(mxconfig.gpio.r1, true, PinOwner::HUB75);
pinManager.allocatePin(mxconfig.gpio.g1, true, PinOwner::HUB75);
pinManager.allocatePin(mxconfig.gpio.b1, true, PinOwner::HUB75);
@@ -601,7 +626,12 @@ void BusHub75Matrix::setPixelColor(uint16_t pix, uint32_t c) {
b = B(c);
x = pix % mxconfig.mx_width;
y = floor(pix / mxconfig.mx_width);
display->drawPixelRGB888(x, y, r, g, b);
if(fourScanPanel != nullptr) {
fourScanPanel->drawPixelRGB888(x, y, r, g, b);
}
else {
display->drawPixelRGB888(x, y, r, g, b);
}
}
void BusHub75Matrix::setBrightness(uint8_t b, bool immediate) {

View File

@@ -3,6 +3,7 @@
#ifdef WLED_ENABLE_HUB75MATRIX
#include <ESP32-HUB75-MatrixPanel-I2S-DMA.h>
#include <ESP32-VirtualMatrixPanel-I2S-DMA.h>
#endif
/*
* Class for addressing various light types
@@ -355,6 +356,8 @@ class BusHub75Matrix : public Bus {
void cleanup() {
deallocatePins();
fourScanPanel = nullptr;
// delete fourScanPanel;
delete display;
_valid = false;
}
@@ -365,6 +368,7 @@ class BusHub75Matrix : public Bus {
private:
MatrixPanel_I2S_DMA *display = nullptr;
VirtualMatrixPanel *fourScanPanel = nullptr;
HUB75_I2S_CFG mxconfig;
uint8_t r, g, b, x, y;

View File

@@ -386,6 +386,8 @@ ${i+1}:
<option value="101">Hub75Matrix 32x32</option>
<option value="102">Hub75Matrix 64x32</option>
<option value="103">Hub75Matrix 64x64</option>
<option value="105">Hub75Matrix 32x32 (Outdoor 8S)</option>
<option value="106">Hub75Matrix 64x64 (Outdoor 16S)</option>
</select><br>
<div id="co${i}" style="display:inline">Color Order:
<select name="CO${i}">