From 228c090185238c61d30a0d0267c515935a8f8770 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Mon, 23 Oct 2023 18:27:02 +0100 Subject: [PATCH 01/63] Start adding SmartMatrix code --- platformio.ini | 1 + wled00/bus_manager.cpp | 27 +++++++++++++++++++++++++++ wled00/bus_manager.h | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) diff --git a/platformio.ini b/platformio.ini index 1e511cf7..09120795 100644 --- a/platformio.ini +++ b/platformio.ini @@ -953,6 +953,7 @@ lib_deps_M = OneWire@~2.3.5 ; used for USERMOD_FOUR_LINE_DISPLAY and USERMOD_DALLASTEMPERATURE olikraus/U8g2 @ ^2.28.8 ; used for USERMOD_FOUR_LINE_DISPLAY ${common_mm.animartrix_lib_deps} + https://github.com/pixelmatix/SmartMatrix.git @ 4.0.3 lib_deps_V4_M = ;https://github.com/blazoncek/OneWire.git ; includes bugfixes for inconsistent readings diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index 2f330b75..dcb668d8 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -458,6 +458,33 @@ void BusNetwork::cleanup() { _data = nullptr; } +// *************************************************************************** +BusSmartMatrix::BusSmartMatrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWhite) { + + #define num_x 64 // how many LEDs are in one row? + #define num_y 64 // how many rows? + #define brightness 255 // please be aware that reducing brightness also reduces color resolution, use only in emergency + + #define radial_filter_radius 23.0; // on 32x32, use 11 for 16x16 + + #define COLOR_DEPTH 24 // Choose the color depth used for storing pixels in the layers: 24 or 48 (24 is good for most sketches - If the sketch uses type `rgb24` directly, COLOR_DEPTH must be 24) + const uint16_t kMatrixWidth = num_x; // Set to the width of your display, must be a multiple of 8 + const uint16_t kMatrixHeight = num_y; // Set to the height of your display + const uint8_t kRefreshDepth = 48; // Tradeoff of color quality vs refresh rate, max brightness, and RAM usage. 36 is typically good, drop down to 24 if you need to. On Teensy, multiples of 3, up to 48: 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48. On ESP32: 24, 36, 48 + const uint8_t kDmaBufferRows = 4; // known working: 2-4, use 2 to save RAM, more to keep from dropping frames and automatically lowering refresh rate. (This isn't used on ESP32, leave as default) + const uint8_t kPanelType = SM_PANELTYPE_HUB75_32ROW_MOD16SCAN; // Choose the configuration that matches your panels. See more details in MatrixCommonHub75.h and the docs: https://github.com/pixelmatix/SmartMatrix/wiki + const uint32_t kMatrixOptions = (SM_HUB75_OPTIONS_NONE); // see docs for options: https://github.com/pixelmatix/SmartMatrix/wiki + const uint8_t kBackgroundLayerOptions = (SM_BACKGROUND_OPTIONS_NONE); + + SMARTMATRIX_ALLOCATE_BUFFERS(matrix, kMatrixWidth, kMatrixHeight, kRefreshDepth, kDmaBufferRows, kPanelType, kMatrixOptions); + SMARTMATRIX_ALLOCATE_BACKGROUND_LAYER(backgroundLayer, kMatrixWidth, kMatrixHeight, COLOR_DEPTH, kBackgroundLayerOptions); + + matrix.addLayer(&backgroundLayer); + matrix.setBrightness(brightness); + matrix.begin(); +} + +// *************************************************************************** //utility to get the approx. memory usage of a given BusConfig uint32_t BusManager::memUsage(BusConfig &bc) { diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index 220fd930..b41a93e8 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -1,6 +1,12 @@ #ifndef BusManager_h #define BusManager_h +#define WLED_ENABLE_SMARTMATRIX + +#ifdef WLED_ENABLE_SMARTMATRIX +#include +#include +#endif /* * Class for addressing various light types */ @@ -326,6 +332,41 @@ class BusNetwork : public Bus { byte *_data; }; +#ifdef WLED_ENABLE_SMARTMATRIX +class BusSmartMatrix : public Bus { + public: + BusSmartMatrix(BusConfig &bc); + + bool hasRGB() { return true; } + bool hasWhite() { return false; } + + void setPixelColor(uint16_t pix, uint32_t c); + + uint32_t __attribute__((pure)) getPixelColor(uint16_t pix); // WLEDMM attribute added + + void show(); + + bool canShow() { + // this should be a return value from UDP routine if it is still sending data out + return true; // !_broadcastLock; // TODO + } + + uint8_t getPins(uint8_t* pinArray); + + uint16_t getLength() { + return _len; + } + + void cleanup(); + + ~BusSmartMatrix() { + cleanup(); + } + + private: + +}; +#endif class BusManager { public: From 47349599e061737cc633161d5cee83883b98ed70 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Mon, 23 Oct 2023 18:33:40 +0100 Subject: [PATCH 02/63] Register SmartMatrix --- wled00/bus_manager.cpp | 2 ++ wled00/const.h | 1 + 2 files changed, 3 insertions(+) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index dcb668d8..d0dae78d 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -516,6 +516,8 @@ int BusManager::add(BusConfig &bc) { busses[numBusses] = new BusDigital(bc, numBusses, colorOrderMap); } else if (bc.type == TYPE_ONOFF) { busses[numBusses] = new BusOnOff(bc); + } else if (bc.type == TYPE_SMARTMATRIX) { + busses[numBusses] = new BusSmartMatrix(bc); } else { busses[numBusses] = new BusPwm(bc); } diff --git a/wled00/const.h b/wled00/const.h index 87375eb3..4307f8f9 100644 --- a/wled00/const.h +++ b/wled00/const.h @@ -240,6 +240,7 @@ #define TYPE_LPD8806 52 #define TYPE_P9813 53 #define TYPE_LPD6803 54 +#define TYPE_SMARTMATRIX 55 //Network types (master broadcast) (80-95) #define TYPE_NET_DDP_RGB 80 //network DDP RGB bus (master broadcast bus) #define TYPE_NET_E131_RGB 81 //network E131 RGB bus (master broadcast bus, unused) From c693ee15361c085bab3ee02f8277c8c3df971063 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Mon, 23 Oct 2023 19:48:41 +0100 Subject: [PATCH 03/63] Impliment BusSmartMatrix --- wled00/bus_manager.cpp | 25 +++++++++++++++++++++---- wled00/bus_manager.h | 25 ++++++++++++++++--------- wled00/data/settings_leds.htm | 2 ++ 3 files changed, 39 insertions(+), 13 deletions(-) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index d0dae78d..d1cc851e 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -476,12 +476,29 @@ BusSmartMatrix::BusSmartMatrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh const uint32_t kMatrixOptions = (SM_HUB75_OPTIONS_NONE); // see docs for options: https://github.com/pixelmatix/SmartMatrix/wiki const uint8_t kBackgroundLayerOptions = (SM_BACKGROUND_OPTIONS_NONE); - SMARTMATRIX_ALLOCATE_BUFFERS(matrix, kMatrixWidth, kMatrixHeight, kRefreshDepth, kDmaBufferRows, kPanelType, kMatrixOptions); + SMARTMATRIX_ALLOCATE_BUFFERS(smartMatrix, kMatrixWidth, kMatrixHeight, kRefreshDepth, kDmaBufferRows, kPanelType, kMatrixOptions); SMARTMATRIX_ALLOCATE_BACKGROUND_LAYER(backgroundLayer, kMatrixWidth, kMatrixHeight, COLOR_DEPTH, kBackgroundLayerOptions); - matrix.addLayer(&backgroundLayer); - matrix.setBrightness(brightness); - matrix.begin(); + + smartMatrix.addLayer(&backgroundLayer); + smartMatrix.setBrightness(brightness); + Serial.printf("BusSmartMatrix: kMatrixWidth=%u, kMatrixHeight=%u", kMatrixWidth, kMatrixHeight); + smartMatrix.begin(); + + this->buffer = backgroundLayer.backBuffer(); + this->backgroundLayer = &backgroundLayer; + this->smartMatrix = &smartMatrix; +} + +void BusSmartMatrix::setPixelColor(uint16_t pix, uint32_t c) { + uint8_t r = R(c); + uint8_t g = G(c); + uint8_t b = B(c); + this->buffer[pix] = rgb24(r, g, b); +} + +void BusSmartMatrix::setBrightness(uint8_t b, bool immediate) { + this->smartMatrix->setBrightness(b); } // *************************************************************************** diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index b41a93e8..e4bd30e4 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -44,6 +44,7 @@ struct BusConfig { if (type >= TYPE_NET_DDP_RGB && type < 96) nPins = 4; //virtual network bus. 4 "pins" store IP address else if (type > 47) nPins = 2; else if (type > 40 && type < 46) nPins = NUM_PWM_PINS(type); + else if (type == TYPE_SMARTMATRIX) nPins = 0; for (uint8_t i = 0; i < nPins; i++) pins[i] = ppins[i]; } @@ -342,28 +343,34 @@ class BusSmartMatrix : public Bus { void setPixelColor(uint16_t pix, uint32_t c); - uint32_t __attribute__((pure)) getPixelColor(uint16_t pix); // WLEDMM attribute added - - void show(); - - bool canShow() { - // this should be a return value from UDP routine if it is still sending data out - return true; // !_broadcastLock; // TODO + void show() { + Serial.println("SmartMatrix: show()"); + backgroundLayer->swapBuffers(true); } - uint8_t getPins(uint8_t* pinArray); + bool canShow() { + // busy swapping still + return !backgroundLayer->isSwapPending(); + } + + void setBrightness(uint8_t b, bool immediate); + + // uint8_t getPins(uint8_t* pinArray) {} // todo uint16_t getLength() { return _len; } - void cleanup(); + void cleanup() {} ~BusSmartMatrix() { cleanup(); } private: + rgb24* buffer; + SMLayerBackground* backgroundLayer; + SmartMatrixHub75Calc<48, 64, 64, 0u, 0u>* smartMatrix; }; #endif diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm index db68c920..9879afa0 100644 --- a/wled00/data/settings_leds.htm +++ b/wled00/data/settings_leds.htm @@ -355,6 +355,7 @@ ${i+1}: +
Color Order:  
`; f.insertAdjacentHTML("beforeend", cn); + // TODO: selective addition of SM } if (n==-1) { o[--i].remove();--i; From e27ada33886249a049a87331576373ef5543f4ef Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Mon, 23 Oct 2023 20:47:03 +0100 Subject: [PATCH 04/63] Fix ordering of Bus Type checking --- wled00/bus_manager.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index d1cc851e..1ab83060 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -527,14 +527,16 @@ uint32_t BusManager::memUsage(BusConfig &bc) { int BusManager::add(BusConfig &bc) { if (getNumBusses() - getNumVirtualBusses() >= WLED_MAX_BUSSES) return -1; + 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_SMARTMATRIX) { + USER_PRINTLN("BusManager::add - Adding BusSmartMatrix"); + busses[numBusses] = new BusSmartMatrix(bc); } else if (IS_DIGITAL(bc.type)) { busses[numBusses] = new BusDigital(bc, numBusses, colorOrderMap); } else if (bc.type == TYPE_ONOFF) { busses[numBusses] = new BusOnOff(bc); - } else if (bc.type == TYPE_SMARTMATRIX) { - busses[numBusses] = new BusSmartMatrix(bc); } else { busses[numBusses] = new BusPwm(bc); } From 9f55d7dfd874637a2f5425f3d3abd0902ace5fdc Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Mon, 23 Oct 2023 22:09:07 +0100 Subject: [PATCH 05/63] Trying to get output working --- wled00/bus_manager.cpp | 30 ++++++++++++++++++++---------- wled00/bus_manager.h | 6 +++--- wled00/const.h | 4 +++- wled00/data/settings_leds.htm | 2 +- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index 1ab83060..1ac702b3 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -459,10 +459,13 @@ void BusNetwork::cleanup() { } // *************************************************************************** + +#ifdef WLED_ENABLE_SMARTMATRIX + BusSmartMatrix::BusSmartMatrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWhite) { - #define num_x 64 // how many LEDs are in one row? - #define num_y 64 // how many rows? + #define num_x 32 // how many LEDs are in one row? + #define num_y 32 // how many rows? #define brightness 255 // please be aware that reducing brightness also reduces color resolution, use only in emergency #define radial_filter_radius 23.0; // on 32x32, use 11 for 16x16 @@ -470,7 +473,7 @@ BusSmartMatrix::BusSmartMatrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh #define COLOR_DEPTH 24 // Choose the color depth used for storing pixels in the layers: 24 or 48 (24 is good for most sketches - If the sketch uses type `rgb24` directly, COLOR_DEPTH must be 24) const uint16_t kMatrixWidth = num_x; // Set to the width of your display, must be a multiple of 8 const uint16_t kMatrixHeight = num_y; // Set to the height of your display - const uint8_t kRefreshDepth = 48; // Tradeoff of color quality vs refresh rate, max brightness, and RAM usage. 36 is typically good, drop down to 24 if you need to. On Teensy, multiples of 3, up to 48: 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48. On ESP32: 24, 36, 48 + const uint8_t kRefreshDepth = 36; // Tradeoff of color quality vs refresh rate, max brightness, and RAM usage. 36 is typically good, drop down to 24 if you need to. On Teensy, multiples of 3, up to 48: 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48. On ESP32: 24, 36, 48 const uint8_t kDmaBufferRows = 4; // known working: 2-4, use 2 to save RAM, more to keep from dropping frames and automatically lowering refresh rate. (This isn't used on ESP32, leave as default) const uint8_t kPanelType = SM_PANELTYPE_HUB75_32ROW_MOD16SCAN; // Choose the configuration that matches your panels. See more details in MatrixCommonHub75.h and the docs: https://github.com/pixelmatix/SmartMatrix/wiki const uint32_t kMatrixOptions = (SM_HUB75_OPTIONS_NONE); // see docs for options: https://github.com/pixelmatix/SmartMatrix/wiki @@ -482,12 +485,19 @@ BusSmartMatrix::BusSmartMatrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh smartMatrix.addLayer(&backgroundLayer); smartMatrix.setBrightness(brightness); - Serial.printf("BusSmartMatrix: kMatrixWidth=%u, kMatrixHeight=%u", kMatrixWidth, kMatrixHeight); + USER_PRINTF("BusSmartMatrix: kMatrixWidth=%u, kMatrixHeight=%u", kMatrixWidth, kMatrixHeight); smartMatrix.begin(); - this->buffer = backgroundLayer.backBuffer(); + smartMatrix->setBrightness(125); // TODO - hard code for now + + rgb24* smBuffer = backgroundLayer.backBuffer(); + + this->buffer = smBuffer; + + backgroundLayer.swapBuffers(true); + this->backgroundLayer = &backgroundLayer; - this->smartMatrix = &smartMatrix; + // this->smartMatrix = &smartMatrix; } void BusSmartMatrix::setPixelColor(uint16_t pix, uint32_t c) { @@ -497,10 +507,10 @@ void BusSmartMatrix::setPixelColor(uint16_t pix, uint32_t c) { this->buffer[pix] = rgb24(r, g, b); } -void BusSmartMatrix::setBrightness(uint8_t b, bool immediate) { - this->smartMatrix->setBrightness(b); -} - +// void BusSmartMatrix::setBrightness(uint8_t b, bool immediate) { +// this->smartMatrix->setBrightness(b); +// } +#endif // *************************************************************************** //utility to get the approx. memory usage of a given BusConfig diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index e4bd30e4..74769316 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -344,7 +344,7 @@ class BusSmartMatrix : public Bus { void setPixelColor(uint16_t pix, uint32_t c); void show() { - Serial.println("SmartMatrix: show()"); + // Serial.println("SmartMatrix: show()"); backgroundLayer->swapBuffers(true); } @@ -353,7 +353,7 @@ class BusSmartMatrix : public Bus { return !backgroundLayer->isSwapPending(); } - void setBrightness(uint8_t b, bool immediate); + // void setBrightness(uint8_t b, bool immediate); // uint8_t getPins(uint8_t* pinArray) {} // todo @@ -370,7 +370,7 @@ class BusSmartMatrix : public Bus { private: rgb24* buffer; SMLayerBackground* backgroundLayer; - SmartMatrixHub75Calc<48, 64, 64, 0u, 0u>* smartMatrix; + // SmartMatrixHub75Calc<36, 32, 32, 0u, 0u>* smartMatrix; }; #endif diff --git a/wled00/const.h b/wled00/const.h index 4307f8f9..3ac7b813 100644 --- a/wled00/const.h +++ b/wled00/const.h @@ -240,7 +240,9 @@ #define TYPE_LPD8806 52 #define TYPE_P9813 53 #define TYPE_LPD6803 54 -#define TYPE_SMARTMATRIX 55 + +#define TYPE_SMARTMATRIX 60 + //Network types (master broadcast) (80-95) #define TYPE_NET_DDP_RGB 80 //network DDP RGB bus (master broadcast bus) #define TYPE_NET_E131_RGB 81 //network E131 RGB bus (master broadcast bus, unused) diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm index 9879afa0..c4da2c24 100644 --- a/wled00/data/settings_leds.htm +++ b/wled00/data/settings_leds.htm @@ -355,7 +355,7 @@ ${i+1}: - +
Color Order:
Color Order:
Color Order:
Color Order:
Color Order:  
`; f.insertAdjacentHTML("beforeend", cn); - // TODO: selective addition of SM } if (n==-1) { o[--i].remove();--i; From 2f87b616cda6a5743a034ede5df7c52aa551f9ee Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Mon, 26 Feb 2024 21:27:27 +0000 Subject: [PATCH 58/63] Default to mrfaptastic pinout --- wled00/bus_manager.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index 41304226..4e3ee762 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -524,7 +524,7 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh mxconfig.gpio.d = 35; mxconfig.gpio.e = 21; -#else +#elif defined(ESP32_FORUM_PINOUT) // Common format for boards designed for SmartMatrix /* @@ -571,6 +571,30 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh mxconfig.gpio.d = 21; mxconfig.gpio.e = 12; +#else + // https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-DMA?tab=readme-ov-file + + // Boards + // https://esp32trinity.com/ + // 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; + #endif From f1a494f82d1bbd967920b207e8a767d59386d7a2 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Mon, 26 Feb 2024 22:47:33 +0000 Subject: [PATCH 59/63] Cleanup comments --- wled00/bus_manager.cpp | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index 4e3ee762..3801c534 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -526,34 +526,16 @@ 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"); +/* 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 - - #define R1_PIN GPIO_NUM_2 - #define G1_PIN GPIO_NUM_15 - #define B1_PIN GPIO_NUM_4 - #define R2_PIN GPIO_NUM_16 - #define G2_PIN GPIO_NUM_27 - #define B2_PIN GPIO_NUM_17 - - #define A_PIN GPIO_NUM_5 - #define B_PIN GPIO_NUM_18 - #define C_PIN GPIO_NUM_19 - #define D_PIN GPIO_NUM_21 - #define E_PIN GPIO_NUM_12 - #define LAT_PIN GPIO_NUM_26 - #define OE_PIN GPIO_NUM_25 - - #define CLK_PIN GPIO_NUM_22 */ - USER_PRINTLN("MatrixPanel_I2S_DMA - ESP32 config"); - mxconfig.gpio.r1 = 2; mxconfig.gpio.g1 = 15; mxconfig.gpio.b1 = 4; @@ -572,12 +554,16 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh mxconfig.gpio.e = 12; #else - // https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-DMA?tab=readme-ov-file + USER_PRINTLN("MatrixPanel_I2S_DMA - Default pins"); + /* + https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-DMA?tab=readme-ov-file - // Boards - // https://esp32trinity.com/ - // https://www.electrodragon.com/product/rgb-matrix-panel-drive-interface-board-for-esp32-dma/ + Boards + https://esp32trinity.com/ + 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; From ab89cd534dccaf6fbb73738077a6dbfccd9a9594 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Wed, 6 Mar 2024 18:56:21 +0000 Subject: [PATCH 60/63] Start playlist at higher ID if needed due to more effects, from usermods --- wled00/data/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wled00/data/index.js b/wled00/data/index.js index c8159d9e..ab724cc4 100644 --- a/wled00/data/index.js +++ b/wled00/data/index.js @@ -3220,6 +3220,7 @@ function genPresets() playlistTrans[m] += playlistSep[m] + "7"; playlistSep[m] = ","; } + var seq=230; //Playlist start here for (let ef of effects) { if (ef.name.indexOf("RSVD") < 0) { if (Array.isArray(fxdata) && fxdata.length>ef.id) { @@ -3261,11 +3262,12 @@ function genPresets() addToPlaylist("All", ef.id); if (m.includes("1")) addToPlaylist("All1", ef.id); if (m.includes("2")) addToPlaylist("All2", ef.id); + + seq = Math.max(seq, (parseInt(ef.id) + 1)); } //fxdata is array } //not RSVD } //all effects - var seq=230; //Playlist start here // console.log(playlistPS, playlistDur, playlistTrans); for (const m in playlistPS) { let playListString = `\n,"${seq}":{"n":"${m}D Playlist","ql":"${seq}","on":true,"playlist":{"ps":[${playlistPS[m]}],"dur":[${playlistDur[m]}],"transition":[${playlistTrans[m]}],"repeat":0,"end":0,"r":1}}`; From fa5f35d87b59630c287e0cfc56a268e843f428af Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Wed, 6 Mar 2024 21:29:35 +0000 Subject: [PATCH 61/63] Improve playlist generation with more user friendly QuickLoad names and also create playlist for AnimARTrix - if present --- wled00/data/index.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/wled00/data/index.js b/wled00/data/index.js index ab724cc4..3ea998e3 100644 --- a/wled00/data/index.js +++ b/wled00/data/index.js @@ -3210,7 +3210,8 @@ function genPresets() var playlistSep = JSON.parse("{}"); var playlistDur = JSON.parse("{}"); var playlistTrans = JSON.parse("{}"); - function addToPlaylist(m, id) { + var playlistQL = JSON.parse("{}"); + function addToPlaylist(m, id, ql = undefined) { if (!playlistPS[m]) playlistPS[m] = ""; if (!playlistDur[m]) playlistDur[m] = ""; if (!playlistTrans[m]) playlistTrans[m] = ""; @@ -3219,6 +3220,7 @@ function genPresets() playlistDur[m] += playlistSep[m] + "100"; playlistTrans[m] += playlistSep[m] + "7"; playlistSep[m] = ","; + if(ql) playlistQL[m] = `${ql}`; } var seq=230; //Playlist start here for (let ef of effects) { @@ -3258,10 +3260,16 @@ function genPresets() } result += `${sep}"${ef.id}":{"n":"${ef.name}","mainseg":0,"seg":[{"id":0,"fx":${ef.id}${defaultString}}]}`; sep = "\n,"; - addToPlaylist(m, ef.id); - addToPlaylist("All", ef.id); - if (m.includes("1")) addToPlaylist("All1", ef.id); - if (m.includes("2")) addToPlaylist("All2", ef.id); + if(m.length <= 3) { + addToPlaylist(m, ef.id, m); + } + else { + addToPlaylist(m, ef.id); + } + addToPlaylist("All", ef.id, "ALL"); + if(ef.name.startsWith("Y💡")) addToPlaylist("AnimARTrix", ef.id, "AM"); + if (m.includes("1")) addToPlaylist("All 1D", ef.id, "1D"); + if (m.includes("2")) addToPlaylist("All 2D", ef.id, "2D"); seq = Math.max(seq, (parseInt(ef.id) + 1)); } //fxdata is array @@ -3270,7 +3278,8 @@ function genPresets() // console.log(playlistPS, playlistDur, playlistTrans); for (const m in playlistPS) { - let playListString = `\n,"${seq}":{"n":"${m}D Playlist","ql":"${seq}","on":true,"playlist":{"ps":[${playlistPS[m]}],"dur":[${playlistDur[m]}],"transition":[${playlistTrans[m]}],"repeat":0,"end":0,"r":1}}`; + if(!playlistQL[m]) playlistQL[m] = seq; + let playListString = `\n,"${seq}":{"n":"${m} Playlist","ql":"${playlistQL[m]}","on":true,"playlist":{"ps":[${playlistPS[m]}],"dur":[${playlistDur[m]}],"transition":[${playlistTrans[m]}],"repeat":0,"end":0,"r":1}}`; // console.log(playListString); result += playListString; seq++; From 77576f68580bcf597dbd864c820f22235d851a76 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Wed, 6 Mar 2024 22:41:07 +0000 Subject: [PATCH 62/63] Better range of speed for AnimARTrix --- usermods/usermod_v2_animartrix/usermod_v2_animartrix.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usermods/usermod_v2_animartrix/usermod_v2_animartrix.h b/usermods/usermod_v2_animartrix/usermod_v2_animartrix.h index b93d3dff..a33b9823 100644 --- a/usermods/usermod_v2_animartrix/usermod_v2_animartrix.h +++ b/usermods/usermod_v2_animartrix/usermod_v2_animartrix.h @@ -96,10 +96,10 @@ class ANIMartRIXMod:public ANIMartRIX { } float speedFactor = 1.0; if (SEGMENT.speed < 128) { - speedFactor = (float) map(SEGMENT.speed, 0, 127, 1, 10) / 10.0f; + speedFactor = (float) map(SEGMENT.speed, 0, 127, 1, 100) / 100.0f; } else{ - speedFactor = map(SEGMENT.speed, 128, 255, 10, 100) / 10; + speedFactor = (float) map(SEGMENT.speed, 128, 255, 10, 100) / 10.0f; } setSpeedFactor(speedFactor); } From d0fe87814eb2bafa9f1491217d535d9dd7c7f792 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Sat, 9 Mar 2024 14:07:33 +0000 Subject: [PATCH 63/63] Disable HUB75 for V4_M builds due to space issues when building on windows --- platformio.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/platformio.ini b/platformio.ini index dca788b8..107ab6fe 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1531,6 +1531,7 @@ lib_deps = ${esp32_4MB_V4_M_base.esp32_lib_deps} lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation build_unflags = ${esp32_4MB_V4_M_base.build_unflags} -D USERMOD_ANIMARTRIX ;; Tips our memory usage over the limit + -D WLED_ENABLE_HUB75MATRIX ;; RAM: [=== ] 25.9% (used 84708 bytes from 327680 bytes) ;; Flash: [==========] 98.5% (used 1549033 bytes from 1572864 bytes)