From 2b1a42392fbf2e3ec61f43596bad71c238b1f59b Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Thu, 10 Oct 2024 21:37:53 +0100 Subject: [PATCH 1/6] compact pin def format --- wled00/bus_manager.cpp | 56 +++++++++++------------------------------- 1 file changed, 15 insertions(+), 41 deletions(-) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index ab124b93a8..bb9c0f0777 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -521,6 +521,10 @@ void BusNetwork::cleanup() { #ifdef WLED_ENABLE_HUB75MATRIX #warning "HUB75 driver enabled (experimental)" +#ifdef ESP8266 +#error ESP8266 does not support HUB75 +#endif + BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWhite) { size_t lastHeap = ESP.getFreeHeap(); @@ -529,15 +533,15 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh fourScanPanel = nullptr; _len = 0; - mxconfig.double_buff = false; // Use our own memory-optimised buffer rather than the driver's own double-buffer - + mxconfig.double_buff = false; // Use our own memory-optimised buffer rather than the driver's own double-buffer + // mxconfig.driver = HUB75_I2S_CFG::ICN2038S; // experimental - use specific shift register driver // mxconfig.driver = HUB75_I2S_CFG::FM6124; // try this driver in case you panel stays dark, or when colors look too pastel // mxconfig.latch_blanking = 3; // mxconfig.i2sspeed = HUB75_I2S_CFG::HZ_10M; // experimental - 5MHZ should be enugh, but colours looks slightly better at 10MHz // mxconfig.min_refresh_rate = 90; - mxconfig.clkphase = false; // can help in case that the leftmost column is invisible, or pixels on the right side "bleeds out" to the left. + mxconfig.clkphase = bc.reversed; // can help in case that the leftmost column is invisible, or pixels on the right side "bleeds out" to the left. // How many panels we have connected, cap at sane value mxconfig.chain_length = max((uint8_t) 1, min(bc.pins[0], (uint8_t) 4)); // prevent bad data preventing boot due to low memory @@ -590,28 +594,15 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh } else mxconfig.setPixelColorDepthBits(8); #endif + +// HUB75_I2S_CFG::i2s_pins _pins={R1_PIN, G1_PIN, B1_PIN, R2_PIN, G2_PIN, B2_PIN, A_PIN, B_PIN, C_PIN, D_PIN, E_PIN, LAT_PIN, OE_PIN, CLK_PIN}; + #if defined(ARDUINO_ADAFRUIT_MATRIXPORTAL_ESP32S3) // MatrixPortal ESP32-S3 // https://www.adafruit.com/product/5778 - USER_PRINTLN("MatrixPanel_I2S_DMA - Matrix Portal S3 config"); + mxconfig.gpio = { 42, 41, 40, 38, 39, 37, 45, 36, 48, 35, 21, 47, 14, 2 }; - mxconfig.gpio.r1 = 42; - mxconfig.gpio.g1 = 41; - mxconfig.gpio.b1 = 40; - mxconfig.gpio.r2 = 38; - mxconfig.gpio.g2 = 39; - mxconfig.gpio.b2 = 37; - - mxconfig.gpio.lat = 47; - mxconfig.gpio.oe = 14; - mxconfig.gpio.clk = 2; - - mxconfig.gpio.a = 45; - mxconfig.gpio.b = 36; - mxconfig.gpio.c = 48; - mxconfig.gpio.d = 35; - mxconfig.gpio.e = 21; #elif defined(CONFIG_IDF_TARGET_ESP32S3) && defined(BOARD_HAS_PSRAM)// ESP32-S3 @@ -689,28 +680,11 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh /* ESP32 with SmartMatrix's default pinout - ESP32_FORUM_PINOUT - https://github.com/pixelmatix/SmartMatrix/blob/teensylc/src/MatrixHardware_ESP32_V0.h - Can use a board like https://github.com/rorosaurus/esp32-hub75-driver */ - mxconfig.gpio.r1 = 2; - mxconfig.gpio.g1 = 15; - mxconfig.gpio.b1 = 4; - mxconfig.gpio.r2 = 16; - mxconfig.gpio.g2 = 27; - mxconfig.gpio.b2 = 17; - - mxconfig.gpio.lat = 26; - mxconfig.gpio.oe = 25; - mxconfig.gpio.clk = 22; - - mxconfig.gpio.a = 5; - mxconfig.gpio.b = 18; - mxconfig.gpio.c = 19; - mxconfig.gpio.d = 21; - mxconfig.gpio.e = 12; + mxconfig.gpio = { 2, 15, 4, 16, 27, 17, 5, 18, 19, 21, 12, 26, 25, 22 }; #else USER_PRINTLN("MatrixPanel_I2S_DMA - Default pins"); @@ -797,9 +771,10 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh if (_ledBuffer) free(_ledBuffer); // should not happen if (_ledsDirty) free(_ledsDirty); // should not happen - + DEBUG_PRINTLN("MatrixPanel_I2S_DMA allocate memory"); _ledsDirty = (byte*) malloc(getBitArrayBytes(_len)); // create LEDs dirty bits - + DEBUG_PRINTLN("MatrixPanel_I2S_DMA allocate memory ok"); + if (_ledsDirty == nullptr) { display->stopDMAoutput(); delete display; display = nullptr; @@ -916,7 +891,6 @@ uint32_t __attribute__((hot)) BusHub75Matrix::getPixelColorRestored(uint16_t pix void BusHub75Matrix::setBrightness(uint8_t b, bool immediate) { _bri = b; - // if (_bri > 238) _bri=238; // not strictly needed. Enable this line if you see glitches at highest brightness. display->setBrightness(_bri); } From df43bd4855f4a8c05e43248922b78ae7b26afc6f Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Thu, 10 Oct 2024 22:07:11 +0100 Subject: [PATCH 2/6] hub75 pin management --- wled00/bus_manager.cpp | 88 +++++++++++++++++------------------------- wled00/bus_manager.h | 6 +-- wled00/pin_manager.cpp | 6 +++ wled00/pin_manager.h | 1 + 4 files changed, 44 insertions(+), 57 deletions(-) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index bb9c0f0777..f97229a3fe 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -697,25 +697,34 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh https://www.electrodragon.com/product/rgb-matrix-panel-drive-interface-board-for-esp32-dma/ */ - mxconfig.gpio.r1 = 25; - mxconfig.gpio.g1 = 26; - mxconfig.gpio.b1 = 27; - mxconfig.gpio.r2 = 14; - mxconfig.gpio.g2 = 12; - mxconfig.gpio.b2 = 13; - - mxconfig.gpio.lat = 4; - mxconfig.gpio.oe = 15; - mxconfig.gpio.clk = 16; - - mxconfig.gpio.a = 23; - mxconfig.gpio.b = 19; - mxconfig.gpio.c = 5; - mxconfig.gpio.d = 17; - mxconfig.gpio.e = 18; + mxconfig.gpio = { 25, 26, 27, 14, 12, 13, 23, 9, 5, 17, 18, 4, 15, 16 }; #endif + uint8_t pins[PIN_COUNT]; + memcpy(pins, &mxconfig.gpio, sizeof(mxconfig.gpio)); + pinManager.allocateMultiplePins(pins, PIN_COUNT, PinOwner::HUB75, true); + + if(bc.colorOrder == COL_ORDER_RGB) { + DEBUG_PRINTLN("MatrixPanel_I2S_DMA = Default color order (RGB)"); + } else if(bc.colorOrder == COL_ORDER_BGR) { + DEBUG_PRINTLN("MatrixPanel_I2S_DMA = color order BGR"); + uint8_t tmpPin; + tmpPin = mxconfig.gpio.r1; + mxconfig.gpio.r1 = mxconfig.gpio.b1; + mxconfig.gpio.b1 = tmpPin; + tmpPin = mxconfig.gpio.r2; + mxconfig.gpio.r2 = mxconfig.gpio.b2; + mxconfig.gpio.b2 = tmpPin; + } + else { + DEBUG_PRINTF("MatrixPanel_I2S_DMA = unsupported color order %u\n", bc.colorOrder); + } + + DEBUG_PRINTF("MatrixPanel_I2S_DMA config - %ux%u length: %u\n", mxconfig.mx_width, mxconfig.mx_height, mxconfig.chain_length); + DEBUG_PRINTF("R1_PIN=%u, G1_PIN=%u, B1_PIN=%u, R2_PIN=%u, G2_PIN=%u, B2_PIN=%u, A_PIN=%u, B_PIN=%u, C_PIN=%u, D_PIN=%u, E_PIN=%u, LAT_PIN=%u, OE_PIN=%u, CLK_PIN=%u\n", + mxconfig.gpio.r1, mxconfig.gpio.g1, mxconfig.gpio.b1, mxconfig.gpio.r2, mxconfig.gpio.g2, mxconfig.gpio.b2, + mxconfig.gpio.a, mxconfig.gpio.b, mxconfig.gpio.c, mxconfig.gpio.d, mxconfig.gpio.e, mxconfig.gpio.lat, mxconfig.gpio.oe, mxconfig.gpio.clk); USER_PRINTF("MatrixPanel_I2S_DMA config - %ux%u (type %u) length: %u, %u bits/pixel.\n", mxconfig.mx_width, mxconfig.mx_height, bc.type, mxconfig.chain_length, mxconfig.getPixelColorDepthBits() * 3); DEBUG_PRINT(F("Free heap: ")); DEBUG_PRINTLN(ESP.getFreeHeap()); lastHeap = ESP.getFreeHeap(); @@ -729,29 +738,9 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh 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); - pinManager.allocatePin(mxconfig.gpio.r2, true, PinOwner::HUB75); - pinManager.allocatePin(mxconfig.gpio.g2, true, PinOwner::HUB75); - pinManager.allocatePin(mxconfig.gpio.b2, true, PinOwner::HUB75); - - pinManager.allocatePin(mxconfig.gpio.lat, true, PinOwner::HUB75); - pinManager.allocatePin(mxconfig.gpio.oe, true, PinOwner::HUB75); - pinManager.allocatePin(mxconfig.gpio.clk, true, PinOwner::HUB75); - - pinManager.allocatePin(mxconfig.gpio.a, true, PinOwner::HUB75); - pinManager.allocatePin(mxconfig.gpio.b, true, PinOwner::HUB75); - pinManager.allocatePin(mxconfig.gpio.c, true, PinOwner::HUB75); - pinManager.allocatePin(mxconfig.gpio.d, true, PinOwner::HUB75); - pinManager.allocatePin(mxconfig.gpio.e, true, PinOwner::HUB75); - - // display->setLatBlanking(4); - USER_PRINTLN("MatrixPanel_I2S_DMA created"); // let's adjust default brightness display->setBrightness8(25); // range is 0-255, 0 - 0%, 255 - 100% - _bri = 25; delay(24); // experimental DEBUG_PRINT(F("heap usage: ")); DEBUG_PRINTLN(lastHeap - ESP.getFreeHeap()); @@ -949,25 +938,18 @@ void BusHub75Matrix::cleanup() { } void BusHub75Matrix::deallocatePins() { + uint8_t pins[PIN_COUNT]; + memcpy(pins, &mxconfig.gpio, sizeof(mxconfig.gpio)); + pinManager.deallocateMultiplePins(pins, PIN_COUNT, PinOwner::HUB75); +} - pinManager.deallocatePin(mxconfig.gpio.r1, PinOwner::HUB75); - pinManager.deallocatePin(mxconfig.gpio.g1, PinOwner::HUB75); - pinManager.deallocatePin(mxconfig.gpio.b1, PinOwner::HUB75); - pinManager.deallocatePin(mxconfig.gpio.r2, PinOwner::HUB75); - pinManager.deallocatePin(mxconfig.gpio.g2, PinOwner::HUB75); - pinManager.deallocatePin(mxconfig.gpio.b2, PinOwner::HUB75); - - pinManager.deallocatePin(mxconfig.gpio.lat, PinOwner::HUB75); - pinManager.deallocatePin(mxconfig.gpio.oe, PinOwner::HUB75); - pinManager.deallocatePin(mxconfig.gpio.clk, PinOwner::HUB75); - - pinManager.deallocatePin(mxconfig.gpio.a, PinOwner::HUB75); - pinManager.deallocatePin(mxconfig.gpio.b, PinOwner::HUB75); - pinManager.deallocatePin(mxconfig.gpio.c, PinOwner::HUB75); - pinManager.deallocatePin(mxconfig.gpio.d, PinOwner::HUB75); - pinManager.deallocatePin(mxconfig.gpio.e, PinOwner::HUB75); - +uint8_t BusHub75Matrix::getPins(uint8_t* pinArray) const { + pinArray[0] = mxconfig.mx_width; + pinArray[1] = mxconfig.mx_height; + pinArray[2] = mxconfig.chain_length; + return 3; } + #endif // *************************************************************************** diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index 677e71de36..0b189799fc 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -387,10 +387,7 @@ class BusHub75Matrix : public Bus { void setBrightness(uint8_t b, bool immediate) override; - uint8_t getPins(uint8_t* pinArray) const override { - pinArray[0] = mxconfig.chain_length; - return 1; - } // Fake value due to keep finaliseInit happy + uint8_t getPins(uint8_t* pinArray) const override; void deallocatePins(); @@ -407,6 +404,7 @@ class BusHub75Matrix : public Bus { unsigned _panelWidth = 0; CRGB *_ledBuffer = nullptr; byte *_ledsDirty = nullptr; + const int PIN_COUNT = 14; }; #endif diff --git a/wled00/pin_manager.cpp b/wled00/pin_manager.cpp index b9d90a7dd4..e6d887c63c 100644 --- a/wled00/pin_manager.cpp +++ b/wled00/pin_manager.cpp @@ -450,6 +450,12 @@ bool PinManagerClass::allocateMultiplePins(const managed_pin_type * mptArray, by return true; } +bool PinManagerClass::allocateMultiplePins(const uint8_t * mptArray, byte arrayElementCount, PinOwner tag, boolean output) { + PinManagerPinType pins[arrayElementCount]; + for (int i=0; i Date: Wed, 13 Nov 2024 14:45:43 +0000 Subject: [PATCH 3/6] Default to Hub75 output for esp32S3_16MB_PSRAM_M_HUB75 --- platformio.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/platformio.ini b/platformio.ini index 49f9da49a3..8ba83c1d27 100644 --- a/platformio.ini +++ b/platformio.ini @@ -2088,6 +2088,7 @@ build_flags = ${common.build_flags} ${esp32s3.build_flags} -Wno-misleading-inden ${common_mm.build_flags_S} ${common_mm.build_flags_M} ${Speed_Flags.build_flags_V4} ;; optimize for speed ${common_mm.HUB75_build_flags} + -D DEFAULT_LED_TYPE=101 -D MOONHUB_S3_PINOUT ;; HUB75 pinout ${common_mm.animartrix_build_flags} -D WLED_RELEASE_NAME=esp32S3_16MB_PSRAM_M_HUB75 From aa53eef2660f326fbef69eb49cb703746caacbe2 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Wed, 13 Nov 2024 20:48:52 +0000 Subject: [PATCH 4/6] Enable color order selection downdown for HUB75 --- wled00/data/settings_leds.htm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm index b01920cf96..746bd35ca7 100644 --- a/wled00/data/settings_leds.htm +++ b/wled00/data/settings_leds.htm @@ -222,7 +222,7 @@ } gId("rf"+n).onclick = (t == 31) ? (()=>{return false}) : (()=>{}); // prevent change for TM1814 gRGBW |= isRGBW = ((t > 17 && t < 22) || (t > 28 && t < 32) || (t > 40 && t < 46 && t != 43) || t == 88); // RGBW checkbox, TYPE_xxxx values from const.h - gId("co"+n).style.display = ((t >= 80 && t < 96) || (t >= 40 && t < 48)||(t >= 100 && t < 110)) ? "none":"inline"; // hide color order for PWM + gId("co"+n).style.display = ((t >= 80 && t < 96) || (t >= 40 && t < 48)) ? "none":"inline"; // hide color order for PWM gId("dig"+n+"w").style.display = (t > 28 && t < 32) ? "inline":"none"; // show swap channels dropdown if (!(t > 28 && t < 32)) d.getElementsByName("WO"+n)[0].value = 0; // reset swapping gId("dig"+n+"c").style.display = ((t >= 40 && t < 48)||(t >= 100 && t < 110)) ? "none":"inline"; // hide count for analog and HUB75 From 532a690fdc3e90cb838f81720df0f2d4b8b39d0f Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Wed, 13 Nov 2024 21:01:42 +0000 Subject: [PATCH 5/6] Update from DEBUG_ to USER_ print --- wled00/bus_manager.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index af4903ec79..02439ed70b 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -789,9 +789,9 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh pinManager.allocateMultiplePins(pins, PIN_COUNT, PinOwner::HUB75, true); if(bc.colorOrder == COL_ORDER_RGB) { - DEBUG_PRINTLN("MatrixPanel_I2S_DMA = Default color order (RGB)"); + USER_PRINTLN("MatrixPanel_I2S_DMA = Default color order (RGB)"); } else if(bc.colorOrder == COL_ORDER_BGR) { - DEBUG_PRINTLN("MatrixPanel_I2S_DMA = color order BGR"); + USER_PRINTLN("MatrixPanel_I2S_DMA = color order BGR"); uint8_t tmpPin; tmpPin = mxconfig.gpio.r1; mxconfig.gpio.r1 = mxconfig.gpio.b1; @@ -801,15 +801,14 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh mxconfig.gpio.b2 = tmpPin; } else { - DEBUG_PRINTF("MatrixPanel_I2S_DMA = unsupported color order %u\n", bc.colorOrder); + USER_PRINTF("MatrixPanel_I2S_DMA = unsupported color order %u\n", bc.colorOrder); } - DEBUG_PRINTF("MatrixPanel_I2S_DMA config - %ux%u length: %u\n", mxconfig.mx_width, mxconfig.mx_height, mxconfig.chain_length); - DEBUG_PRINTF("R1_PIN=%u, G1_PIN=%u, B1_PIN=%u, R2_PIN=%u, G2_PIN=%u, B2_PIN=%u, A_PIN=%u, B_PIN=%u, C_PIN=%u, D_PIN=%u, E_PIN=%u, LAT_PIN=%u, OE_PIN=%u, CLK_PIN=%u\n", + USER_PRINTF("R1_PIN=%u, G1_PIN=%u, B1_PIN=%u, R2_PIN=%u, G2_PIN=%u, B2_PIN=%u, A_PIN=%u, B_PIN=%u, C_PIN=%u, D_PIN=%u, E_PIN=%u, LAT_PIN=%u, OE_PIN=%u, CLK_PIN=%u\n", mxconfig.gpio.r1, mxconfig.gpio.g1, mxconfig.gpio.b1, mxconfig.gpio.r2, mxconfig.gpio.g2, mxconfig.gpio.b2, mxconfig.gpio.a, mxconfig.gpio.b, mxconfig.gpio.c, mxconfig.gpio.d, mxconfig.gpio.e, mxconfig.gpio.lat, mxconfig.gpio.oe, mxconfig.gpio.clk); USER_PRINTF("MatrixPanel_I2S_DMA config - %ux%u (type %u) length: %u, %u bits/pixel.\n", mxconfig.mx_width, mxconfig.mx_height, bc.type, mxconfig.chain_length, mxconfig.getPixelColorDepthBits() * 3); - DEBUG_PRINT(F("Free heap: ")); DEBUG_PRINTLN(ESP.getFreeHeap()); lastHeap = ESP.getFreeHeap(); + USER_PRINT(F("Free heap: ")); USER_PRINTLN(ESP.getFreeHeap()); lastHeap = ESP.getFreeHeap(); // check if we can re-use the existing display driver if (activeDisplay) { @@ -825,7 +824,7 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh || (activeMXconfig.getPixelColorDepthBits() != mxconfig.getPixelColorDepthBits()) ) { // not the same as before - delete old driver - DEBUG_PRINTLN("MatrixPanel_I2S_DMA deleting old driver!"); + USER_PRINTLN("MatrixPanel_I2S_DMA deleting old driver!"); activeDisplay->stopDMAoutput(); delay(28); //#if !defined(CONFIG_IDF_TARGET_ESP32S3) // prevent crash @@ -866,7 +865,7 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh _bri = 25; delay(24); // experimental - DEBUG_PRINT(F("heap usage: ")); DEBUG_PRINTLN(int(lastHeap - ESP.getFreeHeap())); + USER_PRINT(F("heap usage: ")); USER_PRINTLN(int(lastHeap - ESP.getFreeHeap())); // Allocate memory and start DMA display if (newDisplay && (display->begin() == false)) { USER_PRINTLN("****** MatrixPanel_I2S_DMA !KABOOM! I2S memory allocation failed ***********"); @@ -886,7 +885,7 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh if (_ledBuffer) free(_ledBuffer); // should not happen if (_ledsDirty) free(_ledsDirty); // should not happen - DEBUG_PRINTLN("MatrixPanel_I2S_DMA allocate memory"); + USER_PRINTLN("MatrixPanel_I2S_DMA allocate memory"); _ledsDirty = (byte*) malloc(getBitArrayBytes(_len)); // create LEDs dirty bits if (_ledsDirty) setBitArray(_ledsDirty, _len, false); // reset dirty bits @@ -1138,12 +1137,12 @@ uint32_t BusManager::memUsage(BusConfig &bc) { int BusManager::add(BusConfig &bc) { if (getNumBusses() - getNumVirtualBusses() >= WLED_MAX_BUSSES) return -1; - DEBUG_PRINTF("BusManager::add(bc.type=%u)\n", bc.type); + USER_PRINTF("BusManager::add(bc.type=%u)\n", bc.type); if (bc.type >= TYPE_NET_DDP_RGB && bc.type < 96) { busses[numBusses] = new BusNetwork(bc); } else if (bc.type >= TYPE_HUB75MATRIX && bc.type <= (TYPE_HUB75MATRIX + 10)) { #ifdef WLED_ENABLE_HUB75MATRIX - DEBUG_PRINTLN("BusManager::add - Adding BusHub75Matrix"); + USER_PRINTLN("BusManager::add - Adding BusHub75Matrix"); busses[numBusses] = new BusHub75Matrix(bc); USER_PRINTLN("[BusHub75Matrix] "); #else From 0fd263bdb2507e6a630ce58afc7f6e70cc4aee2d Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Thu, 14 Nov 2024 21:13:41 +0000 Subject: [PATCH 6/6] Compact mxconfig.gpio --- wled00/bus_manager.cpp | 54 ++++-------------------------------------- 1 file changed, 4 insertions(+), 50 deletions(-) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index 02439ed70b..5becf40b61 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -689,23 +689,8 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh #else USER_PRINTLN("MatrixPanel_I2S_DMA - S3 with PSRAM"); + mxconfig.gpio = { 1, 2, 42, 41, 40, 39, 45, 48, 47, 21, 38, 8, 3, 18 }; - mxconfig.gpio.r1 = 1; - mxconfig.gpio.g1 = 2; - mxconfig.gpio.b1 = 42; - // 4th pin is GND - mxconfig.gpio.r2 = 41; - mxconfig.gpio.g2 = 40; - mxconfig.gpio.b2 = 39; - mxconfig.gpio.e = 38; - mxconfig.gpio.a = 45; - mxconfig.gpio.b = 48; - mxconfig.gpio.c = 47; - mxconfig.gpio.d = 21; - mxconfig.gpio.clk = 18; - mxconfig.gpio.lat = 8; - mxconfig.gpio.oe = 3; - // 16th pin is GND #endif #elif defined(CONFIG_IDF_TARGET_ESP32S3) // ESP32-S3 HD-WF2 @@ -715,23 +700,8 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh // https://github.com/mrcodetastic/ESP32-HUB75-MatrixPanel-DMA/issues/433 USER_PRINTLN("MatrixPanel_I2S_DMA - HD-WF2 S3 config"); + mxconfig.gpio = {2, 6, 10, 3, 7, 11, 39, 38, 37, 36, 21, 33, 35, 34}; - mxconfig.gpio.r1 = 2; - mxconfig.gpio.g1 = 6; - mxconfig.gpio.b1 = 10; - mxconfig.gpio.r2 = 3; - mxconfig.gpio.g2 = 7; - mxconfig.gpio.b2 = 11; - - mxconfig.gpio.lat = 33; - mxconfig.gpio.oe = 35; - mxconfig.gpio.clk = 34; - - mxconfig.gpio.a = 39; - mxconfig.gpio.b = 38; - mxconfig.gpio.c = 37; - mxconfig.gpio.d = 36; - mxconfig.gpio.e = 21; #elif defined(CONFIG_IDF_TARGET_ESP32S2) // ESP32-S2 @@ -739,23 +709,7 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh // https://github.com/mrcodetastic/ESP32-HUB75-MatrixPanel-DMA/issues/433 USER_PRINTLN("MatrixPanel_I2S_DMA - HD-WF1 S2 config"); - - mxconfig.gpio.r1 = 2; - mxconfig.gpio.g1 = 6; - mxconfig.gpio.b1 = 3; - mxconfig.gpio.r2 = 4; - mxconfig.gpio.g2 = 8; - mxconfig.gpio.b2 = 5; - - mxconfig.gpio.lat = 33; - mxconfig.gpio.oe = 35; - mxconfig.gpio.clk = 34; - - mxconfig.gpio.a = 39; - mxconfig.gpio.b = 38; - mxconfig.gpio.c = 37; - mxconfig.gpio.d = 36; - mxconfig.gpio.e = 12; + mxconfig.gpio = {2, 6, 3, 4, 8, 5, 39, 38, 37, 36, 12, 33, 35, 34}; #elif defined(ESP32_FORUM_PINOUT) // Common format for boards designed for SmartMatrix @@ -792,7 +746,7 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh USER_PRINTLN("MatrixPanel_I2S_DMA = Default color order (RGB)"); } else if(bc.colorOrder == COL_ORDER_BGR) { USER_PRINTLN("MatrixPanel_I2S_DMA = color order BGR"); - uint8_t tmpPin; + int8_t tmpPin; tmpPin = mxconfig.gpio.r1; mxconfig.gpio.r1 = mxconfig.gpio.b1; mxconfig.gpio.b1 = tmpPin;