From da34949d692f5dcc9c3d793756de9b094d89fc87 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Wed, 17 May 2023 13:58:25 +0100 Subject: [PATCH 1/7] First set of code changes to try and bring the SmartMatrix and FastLED into single codebase with #define feature toggle --- AnimARTrix_SmartMatrix.ino | 29 ++++-- animation_collection.ino | 192 ++++++++++++++++++------------------- 2 files changed, 118 insertions(+), 103 deletions(-) diff --git a/AnimARTrix_SmartMatrix.ino b/AnimARTrix_SmartMatrix.ino index 6d20a1e..fa92f4b 100644 --- a/AnimARTrix_SmartMatrix.ino +++ b/AnimARTrix_SmartMatrix.ino @@ -24,16 +24,22 @@ License CC BY-NC 3.0 */ -#include // SmartLED Shield for Teensy 4 (V5) -#include #include +#ifdef ESP32 +#define USE_SMARTMATRIX // Comment/remove this line to swap back to FastLED +#endif + #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 +#ifdef USE_SMARTMATRIX +#include // SmartLED Shield for Teensy 4 (V5) +#include + #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 @@ -45,8 +51,13 @@ 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); +rgb24 *buffer = backgroundLayer.backBuffer(); + +#else +#define NUM_LEDS ((num_x) * (num_y)) +CRGB buffer[num_x * num_y]; // framebuffer +#endif -//#define NUM_LEDS ((num_x) * (num_y)) CRGB leds[num_x * num_y]; // framebuffer float polar_theta[num_x][num_y]; // look-up table for polar angles @@ -106,17 +117,21 @@ float show1, show2, show3, show4, show5, show6, show7, show8, show9, show0; void setup() { - // FastLED.addLeds(leds, NUM_LEDS); - // FastLED.addLeds(leds, NUM_LEDS); - // FastLED.setMaxPowerInVoltsAndMilliamps( 5, 2000); // optional current limiting [5V, 2000mA] Serial.begin(115200); // check serial monitor for current fps count render_polar_lookup_table((num_x / 2) - 0.5, (num_y / 2) - 0.5); // precalculate all polar coordinates - // polar origin is set to matrix centre + +#ifdef USE_SMARTMATRIX // polar origin is set to matrix centre matrix.addLayer(&backgroundLayer); matrix.setBrightness(brightness); matrix.begin(); +#else + // FastLED.addLeds(leds, NUM_LEDS); + FastLED.addLeds(leds, NUM_LEDS); + // FastLED.setMaxPowerInVoltsAndMilliamps( 5, 2000); // optional current limiting [5V, 2000mA] + FastLED.setBrightness(brightness); +#endif } //******************************************************************************************************************* diff --git a/animation_collection.ino b/animation_collection.ino index e90240d..448cdf6 100644 --- a/animation_collection.ino +++ b/animation_collection.ino @@ -1,8 +1,8 @@ void Rotating_Blob() { - get_ready(); - rgb24 *buffer = backgroundLayer.backBuffer(); // for time measurement in report_performance() + get_ready(); // for time measurement in report_performance() + timings.master_speed = 0.01; // speed ratios for the oscillators timings.ratio[0] = 0.1; // higher values = faster transitions @@ -66,8 +66,8 @@ void Rotating_Blob() { void Chasing_Spirals() { - get_ready(); - rgb24 *buffer = backgroundLayer.backBuffer(); // for time measurement in report_performance() + get_ready(); // for time measurement in report_performance() + timings.master_speed = 0.01; // speed ratios for the oscillators timings.ratio[0] = 0.1; // higher values = faster transitions @@ -124,8 +124,8 @@ void Chasing_Spirals() { void Rings() { - get_ready(); - rgb24 *buffer = backgroundLayer.backBuffer(); // for time measurement in report_performance() + get_ready(); // for time measurement in report_performance() + timings.master_speed = 0.01; // speed ratios for the oscillators timings.ratio[0] = 1; // higher values = faster transitions @@ -180,8 +180,8 @@ void Rings() { void Waves() { - get_ready(); - rgb24 *buffer = backgroundLayer.backBuffer(); // for time measurement in report_performance() + get_ready(); // for time measurement in report_performance() + timings.master_speed = 0.01; // speed ratios for the oscillators timings.ratio[0] = 2; // higher values = faster transitions @@ -229,8 +229,8 @@ void Waves() { void Center_Field() { - get_ready(); - rgb24 *buffer = backgroundLayer.backBuffer(); // for time measurement in report_performance() + get_ready(); // for time measurement in report_performance() + timings.master_speed = 0.01; // speed ratios for the oscillators timings.ratio[0] = 1; // higher values = faster transitions @@ -474,8 +474,8 @@ void Caleido2() { void Caleido3() { - get_ready(); - rgb24 *buffer = backgroundLayer.backBuffer(); // for time measurement in report_performance() + get_ready(); // for time measurement in report_performance() + timings.master_speed = 0.004; // speed ratios for the oscillators timings.ratio[0] = 0.02; // higher values = faster transitions @@ -615,8 +615,8 @@ void Lava1() { void Scaledemo1() { - get_ready(); - rgb24 *buffer = backgroundLayer.backBuffer(); + get_ready(); // for time measurement in report_performance() + timings.master_speed = 0.00003; // speed ratios for the oscillators timings.ratio[0] = 4; // higher values = faster transitions @@ -673,8 +673,8 @@ void Scaledemo1() { void Yves() { - get_ready(); - rgb24 *buffer = backgroundLayer.backBuffer(); + get_ready(); // for time measurement in report_performance() + a = micros(); // for time measurement in report_performance() @@ -749,8 +749,8 @@ void Yves() { void Spiralus() { - get_ready(); - rgb24 *buffer = backgroundLayer.backBuffer(); + get_ready(); // for time measurement in report_performance() + timings.master_speed = 0.0011; // speed ratios for the oscillators timings.ratio[0] = 1.5; // higher values = faster transitions @@ -812,8 +812,8 @@ void Spiralus() { void Spiralus2() { - get_ready(); - rgb24 *buffer = backgroundLayer.backBuffer(); + get_ready(); // for time measurement in report_performance() + timings.master_speed = 0.0015; // speed ratios for the oscillators timings.ratio[0] = 1.5; // higher values = faster transitions @@ -878,8 +878,8 @@ void Spiralus2() { void Hot_Blob() { // nice one - get_ready(); - rgb24 *buffer = backgroundLayer.backBuffer(); + get_ready(); // for time measurement in report_performance() + run_default_oscillators(); @@ -930,9 +930,9 @@ void Hot_Blob() { // nice one void Zoom() { // nice one - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + run_default_oscillators(); timings.master_speed = 0.003; @@ -974,9 +974,9 @@ void Zoom() { // nice one void Slow_Fade() { // nice one - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + run_default_oscillators(); timings.master_speed = 0.00005; @@ -1030,9 +1030,9 @@ void Slow_Fade() { // nice one void Polar_Waves() { // nice one - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + @@ -1084,8 +1084,8 @@ void Polar_Waves() { // nice one void RGB_Blobs() { // nice one - get_ready(); - rgb24 *buffer = backgroundLayer.backBuffer(); + get_ready(); // for time measurement in report_performance() + timings.master_speed = 0.2; // master speed @@ -1140,8 +1140,8 @@ void RGB_Blobs() { // nice one void RGB_Blobs2() { // nice one - get_ready(); - rgb24 *buffer = backgroundLayer.backBuffer(); + get_ready(); // for time measurement in report_performance() + timings.master_speed = 0.12; // master speed @@ -1192,9 +1192,9 @@ void RGB_Blobs2() { // nice one void RGB_Blobs3() { // nice one - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.12; // master speed @@ -1245,9 +1245,9 @@ void RGB_Blobs3() { // nice one void RGB_Blobs4() { // nice one - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + @@ -1300,9 +1300,9 @@ void RGB_Blobs4() { // nice one void RGB_Blobs5() { // nice one - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + @@ -1356,9 +1356,9 @@ void RGB_Blobs5() { // nice one void Big_Caleido() { // nice one - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.02; // master speed @@ -1435,9 +1435,9 @@ void Big_Caleido() { // nice one void SM1() { // nice one - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.02; // master speed @@ -1523,9 +1523,9 @@ void SM1() { // nice one void SM2() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.03; // master speed @@ -1589,9 +1589,9 @@ void SM2() { void SM3() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.02; // master speed @@ -1682,9 +1682,9 @@ void SM3() { void SM4() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.02; // master speed @@ -1739,9 +1739,9 @@ void SM4() { void SM5() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.03; // master speed @@ -1834,9 +1834,9 @@ void SM5() { void SM6() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.03; // master speed @@ -1935,9 +1935,9 @@ void SM6() { void SM8() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.06; // master speed @@ -2013,9 +2013,9 @@ void SM8() { void SM9() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.005; // master speed @@ -2094,9 +2094,9 @@ void SM9() { void SM10() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.006; // 0.006 @@ -2179,9 +2179,9 @@ void Complex_Kaleido() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.009; // master speed @@ -2268,9 +2268,9 @@ void Complex_Kaleido_2() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.009; // master speed @@ -2358,9 +2358,9 @@ void Complex_Kaleido_3() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.001; // master speed @@ -2454,9 +2454,9 @@ void Complex_Kaleido_3() { void Complex_Kaleido_4() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.01; // master speed 0.01 in the video @@ -2561,9 +2561,9 @@ void Complex_Kaleido_4() { void Complex_Kaleido_5() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.01; // master speed @@ -2612,9 +2612,9 @@ void Complex_Kaleido_5() { void Complex_Kaleido_6() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.01; // master speed @@ -2671,9 +2671,9 @@ void Complex_Kaleido_6() { void Water() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.037; // master speed @@ -2759,9 +2759,9 @@ void Water() { void Parametric_Water() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.003; // master speed @@ -2853,9 +2853,9 @@ void Parametric_Water() { void Module_Experiment1() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.03; // master speed @@ -2891,9 +2891,9 @@ void Module_Experiment1() { void Module_Experiment2() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.02; // master speed @@ -2931,9 +2931,9 @@ void Module_Experiment2() { void Module_Experiment3() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.01; // master speed @@ -2971,9 +2971,9 @@ void Module_Experiment3() { void Zoom2() { // nice one - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + run_default_oscillators(); timings.master_speed = 0.003; @@ -3012,9 +3012,9 @@ void Zoom2() { // nice one void Module_Experiment4() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.031; // master speed @@ -3088,9 +3088,9 @@ void Module_Experiment4() { void Module_Experiment5() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.031; // master speed @@ -3132,9 +3132,9 @@ void Module_Experiment5() { void Module_Experiment6() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.01; // master speed 0.031 @@ -3196,9 +3196,9 @@ void Module_Experiment6() { void Module_Experiment7() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.005; // master speed 0.031 @@ -3261,9 +3261,9 @@ void Module_Experiment7() { void Module_Experiment8() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.01; // master speed 0.031 @@ -3353,9 +3353,9 @@ void Module_Experiment8() { void Module_Experiment9() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.03; // master speed 0.031 @@ -3397,9 +3397,9 @@ void Module_Experiment9() { void Module_Experiment10() { - get_ready(); + get_ready(); // for time measurement in report_performance() - rgb24 *buffer = backgroundLayer.backBuffer(); + timings.master_speed = 0.01; // master speed 0.031 From c4cab6dd0f08013223179cd096abecd77342c0d0 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Wed, 17 May 2023 14:05:44 +0100 Subject: [PATCH 2/7] First set of code changes to try and bring the SmartMatrix and FastLED into single codebase with #define feature toggle --- animation_collection.ino | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/animation_collection.ino b/animation_collection.ino index 448cdf6..4e94736 100644 --- a/animation_collection.ino +++ b/animation_collection.ino @@ -287,8 +287,7 @@ void Center_Field() { void Distance_Experiment() { - get_ready(); - rgb24 *buffer = backgroundLayer.backBuffer(); // for time measurement in report_performance() + get_ready(); // for time measurement in report_performance() timings.master_speed = 0.01; // speed ratios for the oscillators timings.ratio[0] = 0.2; // higher values = faster transitions @@ -344,8 +343,8 @@ void Distance_Experiment() { void Caleido1() { - get_ready(); - rgb24 *buffer = backgroundLayer.backBuffer(); // for time measurement in report_performance() + get_ready(); // for time measurement in report_performance() + timings.master_speed = 0.003; // speed ratios for the oscillators timings.ratio[0] = 0.02; // higher values = faster transitions @@ -409,8 +408,8 @@ void Caleido1() { void Caleido2() { - get_ready(); - rgb24 *buffer = backgroundLayer.backBuffer(); // for time measurement in report_performance() + get_ready(); // for time measurement in report_performance() + timings.master_speed = 0.002; // speed ratios for the oscillators timings.ratio[0] = 0.02; // higher values = faster transitions @@ -550,8 +549,8 @@ void Caleido3() { void Lava1() { - get_ready(); - rgb24 *buffer = backgroundLayer.backBuffer(); // for time measurement in report_performance() + get_ready(); // for time measurement in report_performance() + timings.master_speed = 0.0015; // speed ratios for the oscillators timings.ratio[0] = 4; // higher values = faster transitions @@ -3486,4 +3485,4 @@ void Module_Experiment10() { buffer[xy(x, y)] = (rgb24)CRGB( CHSV(((a + show1 + show2) + show3), 255, 255)); } } -} \ No newline at end of file +} From 2853b43dc3c11b403373c9b63a1741b2fc72cbd0 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Wed, 17 May 2023 14:06:46 +0100 Subject: [PATCH 3/7] Outout specific get_ready and show_frame methods --- smartmatrix.ino | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/smartmatrix.ino b/smartmatrix.ino index 3fbf20e..37a5ce1 100644 --- a/smartmatrix.ino +++ b/smartmatrix.ino @@ -1,3 +1,4 @@ +#ifdef USE_SMARTMATRIX void get_ready() { // wait until new buffer is ready, measure time a = micros(); @@ -11,7 +12,21 @@ void show_frame(){ // swap buffers, measure time, output current performance c = micros(); // for time measurement in report_performance() EVERY_N_MILLIS(500) report_performance(); // check serial monitor for report } +#else +void get_ready() { + a = micros(); + // while(backgroundLayer.isSwapPending()); + b = micros(); +} + +void show_frame(){ // update LEDs, measure time, output current performance + + FastLED.show(); + c = micros(); // for time measurement in report_performance() + EVERY_N_MILLIS(500) report_performance(); // check serial monitor for report +} +#endif // Show the current framerate, rendered pixels per second, // rendering time & time spend to push the data to the leds. @@ -32,7 +47,10 @@ void report_performance() { Serial.print(round((calc * 100) / total)); Serial.print("% rendering: "); Serial.print(round((push * 100) / total)); Serial.print("% ("); Serial.print(round(calc)); Serial.print(" + "); - Serial.print(round(push)); Serial.print(" µs) Core-temp: "); - Serial.print( tempmonGetTemp() ); Serial.println(" °C"); - + Serial.print(round(push)); Serial.print(" µs) "); +#ifndef ESP32 + Serial.print("Core-temp: %f °C\n", tempmonGetTemp()); +#else + Serial.println(""); +#endif } From 6b400ae7bac91124c465b4b516c0a0c2141a3f7c Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Wed, 17 May 2023 14:08:17 +0100 Subject: [PATCH 4/7] leds array unused --- AnimARTrix_SmartMatrix.ino | 2 -- 1 file changed, 2 deletions(-) diff --git a/AnimARTrix_SmartMatrix.ino b/AnimARTrix_SmartMatrix.ino index fa92f4b..ac6aab3 100644 --- a/AnimARTrix_SmartMatrix.ino +++ b/AnimARTrix_SmartMatrix.ino @@ -58,8 +58,6 @@ rgb24 *buffer = backgroundLayer.backBuffer(); CRGB buffer[num_x * num_y]; // framebuffer #endif -CRGB leds[num_x * num_y]; // framebuffer - float polar_theta[num_x][num_y]; // look-up table for polar angles float distance[num_x][num_y]; // look-up table for polar distances From 878a3fddf0211ec2d9a422bc1e7d9a456a06648e Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Wed, 17 May 2023 14:51:50 +0100 Subject: [PATCH 5/7] Refactor to use setPixelColor --- AnimARTrix_SmartMatrix.ino | 45 ++++---- animation_collection.ino | 222 +++++++++++++++++++------------------ smartmatrix.ino | 11 ++ 3 files changed, 149 insertions(+), 129 deletions(-) diff --git a/AnimARTrix_SmartMatrix.ino b/AnimARTrix_SmartMatrix.ino index ac6aab3..d97da34 100644 --- a/AnimARTrix_SmartMatrix.ino +++ b/AnimARTrix_SmartMatrix.ino @@ -32,30 +32,35 @@ License CC BY-NC 3.0 #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 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 -#ifdef USE_SMARTMATRIX -#include // SmartLED Shield for Teensy 4 (V5) -#include - -#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); -rgb24 *buffer = backgroundLayer.backBuffer(); +#ifdef USE_SMARTMATRIX + #ifdef ESP32 + #include // ESP32 + #else + #include // SmartLED Shield for Teensy 4 (V5) + #endif + + #include + + #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 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); + rgb24 *matrixLeds = backgroundLayer.backBuffer(); #else -#define NUM_LEDS ((num_x) * (num_y)) -CRGB buffer[num_x * num_y]; // framebuffer + #define NUM_LEDS ((num_x) * (num_y)) + CRGB buffer[num_x * num_y]; // framebuffer #endif float polar_theta[num_x][num_y]; // look-up table for polar angles @@ -122,13 +127,13 @@ void setup() { #ifdef USE_SMARTMATRIX // polar origin is set to matrix centre matrix.addLayer(&backgroundLayer); - matrix.setBrightness(brightness); + // matrix.setBrightness(brightness); matrix.begin(); #else // FastLED.addLeds(leds, NUM_LEDS); - FastLED.addLeds(leds, NUM_LEDS); + FastLED.addLeds(buffer, NUM_LEDS); // FastLED.setMaxPowerInVoltsAndMilliamps( 5, 2000); // optional current limiting [5V, 2000mA] - FastLED.setBrightness(brightness); + // FastLED.setBrightness(brightness); #endif } diff --git a/animation_collection.ino b/animation_collection.ino index 4e94736..7a3be22 100644 --- a/animation_collection.ino +++ b/animation_collection.ino @@ -53,9 +53,9 @@ void Rotating_Blob() { pixel.green = show3 / 6; pixel.blue = 0; - pixel = rgb_sanity_check(pixel); + - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + buffer[xy(x, y)] = setPixelColor(pixel); } } @@ -113,9 +113,9 @@ void Chasing_Spirals() { pixel.green = show2 * radial_filter / 2; pixel.blue = show3 * radial_filter / 4; - pixel = rgb_sanity_check(pixel); + - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + buffer[xy(x, y)] = setPixelColor(pixel); } } @@ -170,12 +170,11 @@ void Rings() { pixel.green = show2 / 4; pixel.blue = show3 / 4; - pixel = rgb_sanity_check(pixel); + - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + buffer[xy(x, y)] = setPixelColor(pixel); } - -} + } } void Waves() { @@ -219,9 +218,9 @@ void Waves() { pixel.green = 0; pixel.blue = show2; - pixel = rgb_sanity_check(pixel); + - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + buffer[xy(x, y)] = setPixelColor(pixel); } } @@ -275,9 +274,9 @@ void Center_Field() { pixel.green = show2; pixel.blue = 0; - pixel = rgb_sanity_check(pixel); + - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + buffer[xy(x, y)] = setPixelColor(pixel); } } @@ -331,9 +330,9 @@ void Distance_Experiment() { pixel.green = show2; pixel.blue = 0; - pixel = rgb_sanity_check(pixel); + - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + buffer[xy(x, y)] = setPixelColor(pixel); } } @@ -398,9 +397,9 @@ void Caleido1() { pixel.green = show3 * distance[x][y] / 10; pixel.blue = (show2 + show4) / 2; - pixel = rgb_sanity_check(pixel); + - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + buffer[xy(x, y)] = setPixelColor(pixel); } } @@ -463,9 +462,9 @@ void Caleido2() { pixel.green = show3 * distance[x][y] / 10; pixel.blue = (show2 + show4) / 2; - pixel = rgb_sanity_check(pixel); + - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + buffer[xy(x, y)] = setPixelColor(pixel); } } @@ -538,9 +537,9 @@ void Caleido3() { pixel.blue = 0; } - pixel = rgb_sanity_check(pixel); + - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + buffer[xy(x, y)] = setPixelColor(pixel); } } @@ -603,9 +602,9 @@ void Lava1() { pixel.red = linear*show2; pixel.green = 0.1*linear*(show2-show3); - pixel = rgb_sanity_check(pixel); + - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + buffer[xy(x, y)] = setPixelColor(pixel); } } @@ -661,9 +660,9 @@ void Scaledemo1() { } - pixel = rgb_sanity_check(pixel); + - buffer[kMatrixWidth * y + x] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + buffer[kMatrixWidth * y + x] = setPixelColor(pixel); } } @@ -739,8 +738,8 @@ void Yves() { pixel.green = show3*show4/255; pixel.blue = 0; - pixel = rgb_sanity_check(pixel); - buffer[kMatrixWidth * y + x] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[kMatrixWidth * y + x] = setPixelColor(pixel); } } @@ -802,8 +801,8 @@ void Spiralus() { pixel.green = f*(show1-show2); pixel.blue = f*(show3-show1); - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } @@ -867,8 +866,8 @@ void Spiralus2() { pixel.green = f*(show1-show2); pixel.blue = f*(show3-show1); - pixel = rgb_sanity_check(pixel); - buffer[kMatrixWidth * y + x] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[kMatrixWidth * y + x] = setPixelColor(pixel); } } @@ -920,8 +919,8 @@ void Hot_Blob() { // nice one pixel.red = radial * show2; pixel.green = linear * radial* 0.3* (show2-show4); - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } @@ -961,8 +960,8 @@ void Zoom() { // nice one pixel.green = 0; - pixel = rgb_sanity_check(pixel); - buffer[kMatrixWidth * y + x] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[kMatrixWidth * y + x] = setPixelColor(pixel); } } @@ -1019,8 +1018,8 @@ void Slow_Fade() { // nice one pixel.blue = radial * (show1 - show3) / 5; - pixel = rgb_sanity_check(pixel); - buffer[kMatrixWidth * y + x] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[kMatrixWidth * y + x] = setPixelColor(pixel); } } @@ -1073,8 +1072,8 @@ void Polar_Waves() { // nice one pixel.blue = radial * show3; - pixel = rgb_sanity_check(pixel); - buffer[kMatrixWidth * y + x] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[kMatrixWidth * y + x] = setPixelColor(pixel); } } @@ -1129,8 +1128,8 @@ void RGB_Blobs() { // nice one - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } @@ -1182,8 +1181,8 @@ void RGB_Blobs2() { // nice one pixel.green = radial * (show2-show1); pixel.blue = radial * (show3-show2); - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } @@ -1235,8 +1234,8 @@ void RGB_Blobs3() { // nice one pixel.green = radial * (show2+show1)*0.5 * y/15; pixel.blue = radial * (show3+show2)*0.5 * x/15; - pixel = rgb_sanity_check(pixel); - buffer[kMatrixWidth * y + x] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[kMatrixWidth * y + x] = setPixelColor(pixel); } } @@ -1290,8 +1289,8 @@ void RGB_Blobs4() { // nice one pixel.green = radial * (show2+show1)*0.5 * y/15; pixel.blue = radial * (show3+show2)*0.5 * x/15; - pixel = rgb_sanity_check(pixel); - buffer[kMatrixWidth * y + x] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[kMatrixWidth * y + x] = setPixelColor(pixel); } } @@ -1345,9 +1344,9 @@ void RGB_Blobs5() { // nice one pixel.green = radial * (show2+show1)*0.5 * y/15; pixel.blue = radial * (show3+show2)*0.5 * x/15; - pixel = rgb_sanity_check(pixel); + - buffer[kMatrixWidth * y + x] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + buffer[kMatrixWidth * y + x] = setPixelColor(pixel); } } @@ -1424,9 +1423,9 @@ void Big_Caleido() { // nice one pixel.green = show2-show5; pixel.blue = show3-show2+show1; - pixel = rgb_sanity_check(pixel); - buffer[kMatrixWidth * y + x] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[kMatrixWidth * y + x] = setPixelColor(pixel); } } //show_frame(); @@ -1508,13 +1507,13 @@ void SM1() { // nice one pixel.green = show3+show4; pixel.blue = show5; - pixel = rgb_sanity_check(pixel); + //leds[xy(x, y)] = CRGB(pixel.red, pixel.green, pixel.blue); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + buffer[xy(x, y)] = setPixelColor(pixel); - buffer[xy(31-x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); - buffer[xy(31-x, 31-y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); - buffer[xy(x, 31-y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + buffer[xy(31-x, y)] = setPixelColor(pixel); + buffer[xy(31-x, 31-y)] = setPixelColor(pixel); + buffer[xy(x, 31-y)] = setPixelColor(pixel); } } //show_frame(); @@ -1576,9 +1575,9 @@ void SM2() { pixel.green = show2; pixel.blue = show3; - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } @@ -1670,9 +1669,9 @@ void SM3() { pixel.green = show3; pixel.blue = show5; - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } @@ -1727,9 +1726,9 @@ void SM4() { pixel.green = 0; pixel.blue = colordodge(show2, show1); - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } @@ -1823,9 +1822,9 @@ void SM5() { pixel.green = radial * colordodge(show2,show5); pixel.blue = radial * screen(show3,show6); - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } } @@ -1924,9 +1923,9 @@ void SM6() { pixel.green = 0; pixel.blue = radial * show9; - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } } @@ -2002,9 +2001,9 @@ void SM8() { pixel.green = 0; pixel.blue = show6; - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } } @@ -2084,9 +2083,9 @@ void SM9() { pixel.green = 0; pixel.blue = show6 * linear2; - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } } @@ -2167,9 +2166,9 @@ void SM10() { pixel.green = (show5-50)+(show6/16); pixel.blue = 0;//show6; - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } } @@ -2256,9 +2255,9 @@ void Complex_Kaleido() { pixel.green = 0.3*radial*show6;//(radial*(show1))*0.3f; pixel.blue = radial*show5; - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } } @@ -2345,9 +2344,9 @@ void Complex_Kaleido_2() { pixel.green = 0.3*radial*show6;//(radial*(show1))*0.3f; pixel.blue = radial*show5; - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } } @@ -2444,9 +2443,9 @@ void Complex_Kaleido_3() { pixel.blue = show5 * radial; pixel.red = (1*show1 + 1*show2) - show7/2; - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } } @@ -2551,9 +2550,9 @@ void Complex_Kaleido_4() { //pixel.blue = show5 * radial; //pixel.red = (1*show1 + 1*show2) - show7/2; - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } } @@ -2602,9 +2601,9 @@ void Complex_Kaleido_5() { pixel.red = show1 * radial; - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } } @@ -2661,9 +2660,9 @@ void Complex_Kaleido_6() { pixel.red = show1; pixel.blue = show2; - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } } @@ -2749,9 +2748,9 @@ void Water() { - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } } @@ -2843,9 +2842,9 @@ void Parametric_Water() { - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } } @@ -2881,9 +2880,9 @@ void Module_Experiment1() { pixel.blue = show1; - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } } @@ -2921,9 +2920,9 @@ void Module_Experiment2() { pixel.green = show1 - 80; pixel.blue = show1 - 150; - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } } @@ -2961,9 +2960,9 @@ void Module_Experiment3() { pixel.green = show1 - 80; pixel.blue = show1 - 150; - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } } @@ -3002,8 +3001,8 @@ void Zoom2() { // nice one pixel.blue = 40-show1; - pixel = rgb_sanity_check(pixel); - buffer[kMatrixWidth * y + x] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[kMatrixWidth * y + x] = setPixelColor(pixel); } } @@ -3078,9 +3077,9 @@ void Module_Experiment4() { //pixel.green = show1 - 80; //pixel.blue = show1 - 150; - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } } @@ -3122,9 +3121,9 @@ void Module_Experiment5() { pixel.red = show1; - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } } @@ -3186,9 +3185,9 @@ void Module_Experiment6() { pixel.blue = 0; - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } } @@ -3251,9 +3250,9 @@ void Module_Experiment7() { - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } } @@ -3343,9 +3342,9 @@ void Module_Experiment8() { - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } } @@ -3387,9 +3386,9 @@ void Module_Experiment9() { pixel.red = 10*show1; - pixel = rgb_sanity_check(pixel); - buffer[xy(x, y)] = (rgb24)CRGB(CRGB(pixel.red, pixel.green, pixel.blue)); + + buffer[xy(x, y)] = setPixelColor(pixel); } } } @@ -3478,11 +3477,16 @@ void Module_Experiment10() { - pixel = rgb_sanity_check(pixel); + byte a = millis()/100; - buffer[xy(x, y)] = (rgb24)CRGB( CHSV(((a + show1 + show2) + show3), 255, 255)); + CRGB p = CRGB( CHSV(((a + show1 + show2) + show3), 255, 255)); + rgb p2; + p2.red = p.red; + p2.green = p.green; + p2.blue = p.blue; + buffer[xy(x, y)] = setPixelColor(p2); } } } diff --git a/smartmatrix.ino b/smartmatrix.ino index 37a5ce1..65ec86a 100644 --- a/smartmatrix.ino +++ b/smartmatrix.ino @@ -12,6 +12,12 @@ void show_frame(){ // swap buffers, measure time, output current performance c = micros(); // for time measurement in report_performance() EVERY_N_MILLIS(500) report_performance(); // check serial monitor for report } + +rgb24 setPixelColor(rgb pixel) { + pixel = rgb_sanity_check(pixel); + return rgb24(pixel.red, pixel.green, pixel.blue); +} + #else void get_ready() { @@ -26,6 +32,11 @@ void show_frame(){ // update LEDs, measure time, output current performance c = micros(); // for time measurement in report_performance() EVERY_N_MILLIS(500) report_performance(); // check serial monitor for report } + +CRGB setPixelColor(rgb pixel) { + pixel = rgb_sanity_check(pixel); + return CRGB(pixel.red, pixel.green, pixel.blue); +} #endif // Show the current framerate, rendered pixels per second, From f648e14f6aeec82ace3c50f2f5c403c63c0eff97 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Wed, 17 May 2023 14:53:26 +0100 Subject: [PATCH 6/7] Refactor to use setPixelColor --- AnimARTrix_SmartMatrix.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AnimARTrix_SmartMatrix.ino b/AnimARTrix_SmartMatrix.ino index d97da34..b02c3f6 100644 --- a/AnimARTrix_SmartMatrix.ino +++ b/AnimARTrix_SmartMatrix.ino @@ -57,7 +57,7 @@ const uint16_t kMatrixHeight = num_y; // Set to the height of your display SMARTMATRIX_ALLOCATE_BUFFERS(matrix, kMatrixWidth, kMatrixHeight, kRefreshDepth, kDmaBufferRows, kPanelType, kMatrixOptions); SMARTMATRIX_ALLOCATE_BACKGROUND_LAYER(backgroundLayer, kMatrixWidth, kMatrixHeight, COLOR_DEPTH, kBackgroundLayerOptions); - rgb24 *matrixLeds = backgroundLayer.backBuffer(); + rgb24 *buffer = backgroundLayer.backBuffer(); #else #define NUM_LEDS ((num_x) * (num_y)) CRGB buffer[num_x * num_y]; // framebuffer From e454333f8b2c82312a5c0512696bbe1f9450ebf5 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Wed, 17 May 2023 14:56:39 +0100 Subject: [PATCH 7/7] Rename back to same name and update README --- AnimARTrix_SmartMatrix.ino => ANIMartRIX.ino | 0 README.md | 5 ++++- 2 files changed, 4 insertions(+), 1 deletion(-) rename AnimARTrix_SmartMatrix.ino => ANIMartRIX.ino (100%) diff --git a/AnimARTrix_SmartMatrix.ino b/ANIMartRIX.ino similarity index 100% rename from AnimARTrix_SmartMatrix.ino rename to ANIMartRIX.ino diff --git a/README.md b/README.md index 0b22d19..79d0d54 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,9 @@ Great, please reach out to me and together we'll find a fair licensing solution -------------------------------------------------------------------------------------------- -Installation: Unzip and install all .ino files in one folder and run AnimARTrix_SmartMatrix.ino +Installation: Unzip and install all .ino files in one folder and run ANIMartRIX.ino + +Either comment out of remove the #define USE_SMARTMATRIX to switch between SmartMatrix and FastLED output -------------------------------------------------------------------------------------------- @@ -50,6 +52,7 @@ A big thank you to Sutaburosu, Antti Yliniemi, Yves Bazin & Marc Miller for the [FastLED](https://github.com/FastLED/FastLED) +## Optional Software: [SmartMatrix](https://github.com/pixelmatix/SmartMatrix)