From e3e50c8deabcf3a0eeb1a482dccac5b857c2ab75 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Tue, 16 May 2023 18:36:03 +0100 Subject: [PATCH 1/2] Update config for my ESP32 setup --- AnimARTrix_SmartMatrix.ino | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/AnimARTrix_SmartMatrix.ino b/AnimARTrix_SmartMatrix.ino index 6d20a1e..45ff603 100644 --- a/AnimARTrix_SmartMatrix.ino +++ b/AnimARTrix_SmartMatrix.ino @@ -24,12 +24,13 @@ License CC BY-NC 3.0 */ -#include // SmartLED Shield for Teensy 4 (V5) +#include // ESP32 +// #include // SmartLED Shield for Teensy 4 (V5) #include #include -#define num_x 32 // how many LEDs are in one row? -#define num_y 32 // how many rows? +#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 @@ -39,7 +40,7 @@ const uint16_t kMatrixWidth = num_x; // Set to the width of your display, mus 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 uint8_t kPanelType = SMARTMATRIX_HUB75_64ROW_MOD32SCAN; // 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); From 54610ab4e9ccb3df6d326b1ecc06f77d1d232971 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Tue, 16 May 2023 18:46:28 +0100 Subject: [PATCH 2/2] Use PatternList to cycle effects --- AnimARTrix_SmartMatrix.ino | 135 ++++++++++++++++++++++++++++++++++++- 1 file changed, 134 insertions(+), 1 deletion(-) diff --git a/AnimARTrix_SmartMatrix.ino b/AnimARTrix_SmartMatrix.ino index 45ff603..1b8622e 100644 --- a/AnimARTrix_SmartMatrix.ino +++ b/AnimARTrix_SmartMatrix.ino @@ -101,6 +101,129 @@ rgb pixel; float show1, show2, show3, show4, show5, show6, show7, show8, show9, show0; +//****************************************************************************************************************** +typedef void (*Pattern)(); +typedef Pattern PatternList[]; +typedef struct { + Pattern pattern; + String name; +} PatternAndName; +typedef PatternAndName PatternAndNameList[]; + +int currentPattern = 0; + +void Module_Experiment10(); +void Module_Experiment9(); +void Module_Experiment8(); +void Module_Experiment7(); +void Module_Experiment6(); +void Module_Experiment5(); +void Module_Experiment4(); +void Zoom2(); +void Module_Experiment3(); +void Module_Experiment2(); +void Module_Experiment1(); +void Parametric_Water(); +void Water(); +void Complex_Kaleido_6(); +void Complex_Kaleido_5(); +void Complex_Kaleido_4(); +void Complex_Kaleido_3(); +void Complex_Kaleido_2(); +void Complex_Kaleido(); +void SM10(); +void SM9(); +void SM8(); +void SM7(); +void SM6(); +void SM5(); +void SM4(); +void SM3(); +void SM2(); +void SM1(); +void Big_Caleido(); +void RGB_Blobs5(); +void RGB_Blobs4(); +void RGB_Blobs3(); +void RGB_Blobs2(); +void RGB_Blobs(); +void Polar_Waves(); +void Slow_Fade(); +void Zoom(); +void Hot_Blob(); +void Spiralus2(); +void Spiralus(); +void Yves(); +void Scaledemo1(); +void Lava1(); +void Caleido3(); +void Caleido2(); +void Caleido1(); +void Distance_Experiment(); +void Center_Field(); +void Waves(); +void Chasing_Spirals(); +void Rotating_Blob(); + +PatternAndNameList gPatterns = { +{Module_Experiment10,"Module_Experiment10"}, +{Module_Experiment9,"Module_Experiment9"}, +{Module_Experiment8,"Module_Experiment8"}, +{Module_Experiment7,"Module_Experiment7"}, +{Module_Experiment6,"Module_Experiment6"}, +{Module_Experiment5,"Module_Experiment5"}, +{Module_Experiment4,"Module_Experiment4"}, +{Zoom2, "Zoom2"}, +{Module_Experiment3,"Module_Experiment3"}, +{Module_Experiment2,"Module_Experiment2"}, +{Module_Experiment1,"Module_Experiment1"}, +{Parametric_Water,"Parametric_Water"}, +{Water,"Water"}, +{Complex_Kaleido_6,"Complex_Kaleido_6"}, +{Complex_Kaleido_5,"Complex_Kaleido_5"}, +{Complex_Kaleido_4,"Complex_Kaleido_4"}, +{Complex_Kaleido_3, "Complex_Kaleido_3"}, +{Complex_Kaleido_2,"Complex_Kaleido_2"}, +{Complex_Kaleido, "Complex_Kaleido"}, +{SM10,"SM10"}, +{SM9,"SM9"}, +{SM8,"SM8"}, +// {SM7,"SM7"}, +{SM6,"SM6"}, +{SM5,"SM5"}, +{SM4,"SM4"}, +{SM3,"SM3"}, +{SM2,"SM2"}, +{SM1,"SM1"}, +{Big_Caleido,"Big_Caleido"}, +{RGB_Blobs5,"RGB_Blobs5"}, +{RGB_Blobs4,"RGB_Blobs4"}, +{RGB_Blobs3,"RGB_Blobs3"}, +{RGB_Blobs2,"RGB_Blobs2"}, +{RGB_Blobs,"RGB_Blobs"}, +{Polar_Waves,"Polar_Waves"}, +{Slow_Fade,"Slow_Fade"}, +{Zoom,"Zoom"}, +{Hot_Blob,"Hot_Blob"}, +{Spiralus2,"Spiralus2"}, +{Spiralus,"Spiralus"}, +{Yves,"Yves"}, +{Scaledemo1,"Scaledemo1"}, +{Lava1,"Lava1"}, +{Caleido3,"Caleido3"}, +{Caleido2,"Caleido2"}, +{Caleido1,"Caleido1"}, +{Distance_Experiment,"Distance_Experiment"}, +{Center_Field,"Center_Field"}, +{Waves,"Waves"}, +{Chasing_Spirals,"Chasing_Spirals"}, +{Rotating_Blob,"Rotating_Blob"}, +}; + +#define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0])) +int gPatternCount = ARRAY_SIZE(gPatterns); + + //****************************************************************************************************************** @@ -140,7 +263,7 @@ void loop() { //Water(); // nice water simulation //Complex_Kaleido_6(); // red blue moire //Complex_Kaleido_5(); // interference pattern - Complex_Kaleido_4(); // colorful slow mandala + // Complex_Kaleido_4(); // colorful slow mandala //Complex_Kaleido_3(); //Complex_Kaleido_2(); // hypnotic smooth //Complex_Kaleido(); @@ -178,6 +301,16 @@ void loop() { //Chasing_Spirals(); // slim //Rotating_Blob(); // + EVERY_N_SECONDS(90) { + currentPattern = random(0, (gPatternCount - 1)); +// autopgm++; + // if (autopgm >= gPatternCount) autopgm = 1; + Serial.print("Next Auto pattern: "); + Serial.println(gPatterns[currentPattern].name); + } + + gPatterns[currentPattern].pattern(); + show_frame(); }