hub75 - remove hard coded panel sizes

This commit is contained in:
Will Tatam
2024-09-08 13:33:34 +01:00
parent e94943d505
commit e066b502c3
4 changed files with 23 additions and 22 deletions

View File

@@ -519,6 +519,7 @@ build_flags = ${common.build_flags} ${esp32s2.build_flags} -D WLED_RELEASE_NAME=
lib_deps = ${esp32s2.lib_deps} lib_deps = ${esp32s2.lib_deps}
${esp32.AR_lib_deps} ${esp32.AR_lib_deps}
;; TODO - move to sample ini
[env:esp32dev_hub75] [env:esp32dev_hub75]
board = esp32dev board = esp32dev
upload_speed = 921600 upload_speed = 921600
@@ -528,8 +529,9 @@ build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} build_flags = ${common.build_flags}
-D WLED_RELEASE_NAME=ESP32_hub75 -D WLED_RELEASE_NAME=ESP32_hub75
-D WLED_ENABLE_HUB75MATRIX -D NO_GFX -D WLED_ENABLE_HUB75MATRIX -D NO_GFX
-D WLED_DEBUG
lib_deps = ${esp32_idf_V4.lib_deps} lib_deps = ${esp32_idf_V4.lib_deps}
https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-DMA.git @ 3.0.10 https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-DMA.git#3.0.11
monitor_filters = esp32_exception_decoder monitor_filters = esp32_exception_decoder
board_build.partitions = ${esp32.default_partitions} board_build.partitions = ${esp32.default_partitions}

View File

@@ -790,31 +790,24 @@ void BusNetwork::cleanup(void) {
BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWhite) { BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWhite) {
mxconfig.double_buff = false; // <------------- Turn on double buffer mxconfig.double_buff = true; // <------------- Turn on double buffer
switch(bc.type) { switch(bc.type) {
case 101: case TYPE_HUB75MATRIX_HS:
mxconfig.mx_width = 32; mxconfig.mx_width = bc.pins[0];
mxconfig.mx_height = 32; mxconfig.mx_height = bc.pins[1];
break;
case 102:
mxconfig.mx_width = 64;
mxconfig.mx_height = 32;
break;
case 103:
mxconfig.mx_width = 64;
mxconfig.mx_height = 64;
break; break;
} }
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 mxconfig.chain_length = max((u_int8_t) 1, min(bc.pins[2], (u_int8_t) 4)); // prevent bad data preventing boot due to low memory
if(mxconfig.mx_width >= 64 && (bc.pins[0] > 1)) { if(mxconfig.mx_height >= 64 && (bc.pins[2] > 1)) {
DEBUG_PRINTLN("WARNING, only single panel can be used of 64 pixel boards due to memory") DEBUG_PRINTLN("WARNING, only single panel can be used of 64 pixel boards due to memory")
mxconfig.chain_length = 1; mxconfig.chain_length = 1;
} }
// mxconfig.driver = HUB75_I2S_CFG::SHIFTREG; // mxconfig.driver = HUB75_I2S_CFG::SHIFTREG;
mxconfig.clkphase = bc.reversed;
#if defined(ARDUINO_ADAFRUIT_MATRIXPORTAL_ESP32S3) // MatrixPortal ESP32-S3 #if defined(ARDUINO_ADAFRUIT_MATRIXPORTAL_ESP32S3) // MatrixPortal ESP32-S3
@@ -977,8 +970,8 @@ void BusHub75Matrix::deallocatePins() {
std::vector<LEDType> BusHub75Matrix::getLEDTypes() { std::vector<LEDType> BusHub75Matrix::getLEDTypes() {
return { return {
{TYPE_HUB75MATRIX_HS, "H", PSTR("HUB75 - Half Scan")}, {TYPE_HUB75MATRIX_HS, "H", PSTR("HUB75 (Half Scan)")},
// {TYPE_HUB75MATRIX_QS, "H", PSTR("HUB75 - Quarter Scan")}, // {TYPE_HUB75MATRIX_QS, "H", PSTR("HUB75 (Quarter Scan)")},
}; };
} }

View File

@@ -143,7 +143,7 @@ class Bus {
static constexpr bool isOnOff(uint8_t type) { return (type == TYPE_ONOFF); } static constexpr bool isOnOff(uint8_t type) { return (type == TYPE_ONOFF); }
static constexpr bool isPWM(uint8_t type) { return (type >= TYPE_ANALOG_MIN && type <= TYPE_ANALOG_MAX); } static constexpr bool isPWM(uint8_t type) { return (type >= TYPE_ANALOG_MIN && type <= TYPE_ANALOG_MAX); }
static constexpr bool isVirtual(uint8_t type) { return (type >= TYPE_VIRTUAL_MIN && type <= TYPE_VIRTUAL_MAX); } static constexpr bool isVirtual(uint8_t type) { return (type >= TYPE_VIRTUAL_MIN && type <= TYPE_VIRTUAL_MAX); }
static constexpr bool isHub75(uint8_t type) { return (type >= TYPE_HUB75MATRIX); } static constexpr bool isHub75(uint8_t type) { return (type >= TYPE_HUB75MATRIX_MIN && type <= TYPE_HUB75MATRIX_MAX); }
static constexpr bool is16bit(uint8_t type) { return type == TYPE_UCS8903 || type == TYPE_UCS8904 || type == TYPE_SM16825; } static constexpr bool is16bit(uint8_t type) { return type == TYPE_UCS8903 || type == TYPE_UCS8904 || type == TYPE_SM16825; }
static constexpr int numPWMPins(uint8_t type) { return (type - 40); } static constexpr int numPWMPins(uint8_t type) { return (type - 40); }

View File

@@ -248,14 +248,14 @@
p0d = "Config:" p0d = "Config:"
break; break;
case 'H': // HUB75 case 'H': // HUB75
p0d = "Chin Length:" p0d = "Panel size (width x height):"
break; break;
} }
gId("p0d"+n).innerText = p0d; gId("p0d"+n).innerText = p0d;
gId("p1d"+n).innerText = p1d; gId("p1d"+n).innerText = p1d;
gId("off"+n).innerText = off; gId("off"+n).innerText = off;
// secondary pins show/hide (type string length is equivalent to number of pins used; except for network and on/off) // secondary pins show/hide (type string length is equivalent to number of pins used; except for network and on/off)
let pins = Math.max(gT(t).t.length,1) + 3*isNet(t); // fixes network pins to 4 let pins = Math.max(gT(t).t.length,1) + 3*isNet(t) + 1*isHub75(t); // fixes network pins to 4
for (let p=1; p<5; p++) { for (let p=1; p<5; p++) {
var LK = d.Sf["L"+p+n]; var LK = d.Sf["L"+p+n];
if (!LK) continue; if (!LK) continue;
@@ -283,12 +283,12 @@
} }
gId("rf"+n).onclick = (t == 31) ? (()=>{return false}) : (()=>{}); // prevent change for TM1814 gId("rf"+n).onclick = (t == 31) ? (()=>{return false}) : (()=>{}); // prevent change for TM1814
gRGBW |= hasW(t); // RGBW checkbox gRGBW |= hasW(t); // RGBW checkbox
gId("co"+n).style.display = (isVir(t) || isAna(t)) ? "none":"inline"; // hide color order for PWM gId("co"+n).style.display = (isVir(t) || isAna(t) || isHub75(t)) ? "none":"inline"; // hide color order for PWM
gId("dig"+n+"w").style.display = (isDig(t) && hasW(t)) ? "inline":"none"; // show swap channels dropdown gId("dig"+n+"w").style.display = (isDig(t) && hasW(t)) ? "inline":"none"; // show swap channels dropdown
gId("dig"+n+"w").querySelector("[data-opt=CCT]").disabled = !hasCCT(t); // disable WW/CW swapping gId("dig"+n+"w").querySelector("[data-opt=CCT]").disabled = !hasCCT(t); // disable WW/CW swapping
if (!(isDig(t) && hasW(t))) d.Sf["WO"+n].value = 0; // reset swapping if (!(isDig(t) && hasW(t))) d.Sf["WO"+n].value = 0; // reset swapping
gId("dig"+n+"c").style.display = (isAna(t) || isHub75(t)) ? "none":"inline"; // hide count for analog gId("dig"+n+"c").style.display = (isAna(t) || isHub75(t)) ? "none":"inline"; // hide count for analog
gId("dig"+n+"r").style.display = (isVir(t) || isHub75(t)) ? "none":"inline"; // hide reversed for virtual gId("dig"+n+"r").style.display = (isVir(t)) ? "none":"inline"; // hide reversed for virtual
gId("dig"+n+"s").style.display = (isVir(t) || isAna(t) || isHub75(t)) ? "none":"inline"; // hide skip 1st for virtual & analog gId("dig"+n+"s").style.display = (isVir(t) || isAna(t) || isHub75(t)) ? "none":"inline"; // hide skip 1st for virtual & analog
gId("dig"+n+"f").style.display = (isDig(t) || (isPWM(t) && maxL>2048)) ? "inline":"none"; // hide refresh (PWM hijacks reffresh for dithering on ESP32) gId("dig"+n+"f").style.display = (isDig(t) || (isPWM(t) && maxL>2048)) ? "inline":"none"; // hide refresh (PWM hijacks reffresh for dithering on ESP32)
gId("dig"+n+"a").style.display = (hasW(t)) ? "inline":"none"; // auto calculate white gId("dig"+n+"a").style.display = (hasW(t)) ? "inline":"none"; // auto calculate white
@@ -339,6 +339,12 @@
LC.min = 0; LC.min = 0;
LC.style.color="#fff"; LC.style.color="#fff";
return; // do not check conflicts return; // do not check conflicts
}
else if (isHub75(t)) {
LC.max = 128;
LC.min = 16;
LC.style.color="#fff";
return; // do not check conflicts
} else { } else {
LC.max = d.max_gpio; LC.max = d.max_gpio;
LC.min = -1; LC.min = -1;