Swap to new way to have dynamic LED types list

This commit is contained in:
Will Tatam
2024-09-07 20:29:43 +01:00
parent 74f77a7e8a
commit ecd46f2f06
4 changed files with 26 additions and 11 deletions

View File

@@ -525,7 +525,8 @@ upload_speed = 921600
platform = ${esp32_idf_V4.platform}
platform_packages = ${esp32_idf_V4.platform_packages}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp32_V4} -D WLED_RELEASE_NAME=ESP32_hub75
build_flags = ${common.build_flags}
-D WLED_RELEASE_NAME=ESP32_hub75
-D WLED_ENABLE_HUB75MATRIX -D NO_GFX
lib_deps = ${esp32_idf_V4.lib_deps}
https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-DMA.git @ 3.0.10

View File

@@ -810,7 +810,7 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh
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
if(mxconfig.mx_width >= 64 && (bc.pins[0] > 1)) {
DEBUG_PRINTF("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;
}
@@ -820,7 +820,7 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh
// https://www.adafruit.com/product/5778
DEBUG_PRINTF("MatrixPanel_I2S_DMA - Matrix Portal S3 config");
DEBUG_PRINTLN("MatrixPanel_I2S_DMA - Matrix Portal S3 config");
mxconfig.gpio.r1 = 42;
mxconfig.gpio.g1 = 41;
@@ -841,7 +841,7 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh
#elif defined(ESP32_FORUM_PINOUT) // Common format for boards designed for SmartMatrix
USER_PRINTLN("MatrixPanel_I2S_DMA - ESP32_FORUM_PINOUT");
DEBUG_PRINTLN("MatrixPanel_I2S_DMA - ESP32_FORUM_PINOUT");
/*
ESP32 with SmartMatrix's default pinout - ESP32_FORUM_PINOUT
@@ -869,7 +869,7 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh
mxconfig.gpio.e = 12;
#else
USER_PRINTLN("MatrixPanel_I2S_DMA - Default pins");
DEBUG_PRINTLN("MatrixPanel_I2S_DMA - Default pins");
/*
https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-DMA?tab=readme-ov-file
@@ -925,20 +925,20 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh
// display->setLatBlanking(4);
DEBUG_PRINTF("MatrixPanel_I2S_DMA created");
DEBUG_PRINTLN("MatrixPanel_I2S_DMA created");
// let's adjust default brightness
display->setBrightness8(25); // range is 0-255, 0 - 0%, 255 - 100%
// Allocate memory and start DMA display
if( not display->begin() ) {
DEBUG_PRINTF("****** MatrixPanel_I2S_DMA !KABOOM! I2S memory allocation failed ***********");
DEBUG_PRINTLN("****** MatrixPanel_I2S_DMA !KABOOM! I2S memory allocation failed ***********");
return;
}
else {
_valid = true;
}
DEBUG_PRINTF("MatrixPanel_I2S_DMA started");
DEBUG_PRINTLN("MatrixPanel_I2S_DMA started");
}
void BusHub75Matrix::setPixelColor(uint16_t pix, uint32_t c) {
@@ -974,6 +974,16 @@ void BusHub75Matrix::deallocatePins() {
pinManager.deallocatePin(mxconfig.gpio.e, PinOwner::HUB75);
}
std::vector<LEDType> BusHub75Matrix::getLEDTypes() {
return {
{TYPE_HUB75MATRIX + 1, "H", PSTR("HUB75 32x32")},
{TYPE_HUB75MATRIX + 2, "H", PSTR("HUB75 64x32")},
{TYPE_HUB75MATRIX + 3, "H", PSTR("HUB75 64x64")},
};
}
#endif
// ***************************************************************************
@@ -1042,6 +1052,10 @@ String BusManager::getLEDTypesJSONString(void) {
json += LEDTypesToJson(BusPwm::getLEDTypes());
json += LEDTypesToJson(BusNetwork::getLEDTypes());
//json += LEDTypesToJson(BusVirtual::getLEDTypes());
#ifdef WLED_ENABLE_HUB75MATRIX
json += LEDTypesToJson(BusHub75Matrix::getLEDTypes());
#endif
json.setCharAt(json.length()-1, ']'); // replace last comma with bracket
return json;
}

View File

@@ -143,6 +143,7 @@ class Bus {
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 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 is16bit(uint8_t type) { return type == TYPE_UCS8903 || type == TYPE_UCS8904 || type == TYPE_SM16825; }
static constexpr int numPWMPins(uint8_t type) { return (type - 40); }
@@ -349,6 +350,8 @@ class BusHub75Matrix : public Bus {
cleanup();
}
static std::vector<LEDType> getLEDTypes(void);
private:
MatrixPanel_I2S_DMA *display = nullptr;
HUB75_I2S_CFG mxconfig;

View File

@@ -784,9 +784,6 @@ void getSettingsJS(byte subPage, char* dest)
#else
oappend(SET_F("gId(\"somp\").remove(1);")); // remove 2D option from dropdown
#endif
#ifndef WLED_ENABLE_HUB75MATRIX
oappend(SET_F("hideHub75();")); // hide HUB75 LED types
#endif
}
}