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: