Good news, 1 out of every 2 animations (roughly) is working
This commit is contained in:
parent
1a19425592
commit
1ed3c99141
@ -2,6 +2,7 @@
|
|||||||
#define SMARTMATRIXPHYSICALMATRIX_H
|
#define SMARTMATRIXPHYSICALMATRIX_H
|
||||||
|
|
||||||
#ifdef CORE_TEENSY
|
#ifdef CORE_TEENSY
|
||||||
|
#ifdef ENABLE_TEENSY_SMARTMATRIX
|
||||||
|
|
||||||
#include "SmartMatrix.h"
|
#include "SmartMatrix.h"
|
||||||
#include "LEDHAL2D.h"
|
#include "LEDHAL2D.h"
|
||||||
@ -47,3 +48,4 @@ class SmartMatrixPhysicalMatrix : public LEDHAL2D {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
@ -10,30 +10,25 @@
|
|||||||
|
|
||||||
[platformio]
|
[platformio]
|
||||||
default_envs =
|
default_envs =
|
||||||
uno
|
|
||||||
teensy36
|
|
||||||
mega2560
|
|
||||||
esp32
|
esp32
|
||||||
|
|
||||||
[common]
|
[common]
|
||||||
|
|
||||||
[env:teensy36]
|
[env:teensy36]
|
||||||
platform = teensy
|
platform = teensy
|
||||||
framework = arduino
|
|
||||||
board = teensy36
|
board = teensy36
|
||||||
|
framework = arduino
|
||||||
lib_deps =
|
lib_deps =
|
||||||
fastled/FastLED@^3.7.0
|
fastled/FastLED@3.10.1
|
||||||
pixelmatix/SmartMatrix@^4.0.3
|
|
||||||
pfeerick/elapsedMillis@^1.0.6
|
pfeerick/elapsedMillis@^1.0.6
|
||||||
adafruit/Adafruit GFX Library@^1.11.9
|
adafruit/Adafruit GFX Library@^1.11.9
|
||||||
arduino-libraries/SD@^1.3.0
|
|
||||||
|
|
||||||
[env:uno]
|
[env:uno]
|
||||||
platform = atmelavr
|
platform = atmelavr
|
||||||
board = uno
|
board = uno
|
||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps =
|
lib_deps =
|
||||||
fastled/FastLED@^3.7.0
|
fastled/FastLED@3.10.1
|
||||||
pfeerick/elapsedMillis@^1.0.6
|
pfeerick/elapsedMillis@^1.0.6
|
||||||
adafruit/Adafruit GFX Library@^1.11.9
|
adafruit/Adafruit GFX Library@^1.11.9
|
||||||
arduino-libraries/SD@^1.3.0
|
arduino-libraries/SD@^1.3.0
|
||||||
@ -43,7 +38,7 @@ platform = atmelavr
|
|||||||
board = megaatmega2560
|
board = megaatmega2560
|
||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps =
|
lib_deps =
|
||||||
fastled/FastLED@^3.7.0
|
fastled/FastLED@3.10.1
|
||||||
pfeerick/elapsedMillis@^1.0.6
|
pfeerick/elapsedMillis@^1.0.6
|
||||||
adafruit/Adafruit GFX Library@^1.11.9
|
adafruit/Adafruit GFX Library@^1.11.9
|
||||||
arduino-libraries/SD@^1.3.0
|
arduino-libraries/SD@^1.3.0
|
||||||
@ -53,6 +48,6 @@ platform = espressif32
|
|||||||
board = adafruit_feather_esp32s3_nopsram
|
board = adafruit_feather_esp32s3_nopsram
|
||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps =
|
lib_deps =
|
||||||
fastled/FastLED@^3.7.0
|
fastled/FastLED@3.10.1
|
||||||
pfeerick/elapsedMillis@^1.0.6
|
pfeerick/elapsedMillis@^1.0.6
|
||||||
adafruit/Adafruit GFX Library@^1.11.9
|
adafruit/Adafruit GFX Library@^1.11.9
|
||||||
|
48
src/main.cpp
48
src/main.cpp
@ -1,14 +1,24 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
#ifdef CORE_TEENSY
|
#ifdef CORE_TEENSY
|
||||||
|
#ifdef ENABLE_TEENSY_SMARTMATRIX
|
||||||
#include "MatrixHardware_Teensy3_ShieldV1toV3.h"
|
#include "MatrixHardware_Teensy3_ShieldV1toV3.h"
|
||||||
#include "SmartMatrix.h"
|
#include "SmartMatrix.h"
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "FastLED.h"
|
#include "FastLED.h"
|
||||||
#include "LEDHAL.h"
|
#include "LEDHAL.h"
|
||||||
#include "LEDHAL2D.h"
|
#include "LEDHAL2D.h"
|
||||||
#include "MatrixAnimation.h"
|
#include "MatrixAnimation.h"
|
||||||
|
#include "AlternateMatrix.h"
|
||||||
|
#include "CollisionMatrix.h"
|
||||||
|
#include "ColorRandomizerMatrix.h"
|
||||||
|
#include "CycleLightMatrix.h"
|
||||||
|
#include "FireworksMatrix.h"
|
||||||
|
#include "FluidColorMatrix.h"
|
||||||
|
#include "RicochetMatrix.h"
|
||||||
|
#include "CycloneMatrix.h"
|
||||||
#include "PlasmaMatrix.h"
|
#include "PlasmaMatrix.h"
|
||||||
#include "CLEDControllerPhysicalStrip.h"
|
#include "CLEDControllerPhysicalStrip.h"
|
||||||
#include "CLEDControllerPhysicalMatrix.h"
|
#include "CLEDControllerPhysicalMatrix.h"
|
||||||
@ -17,6 +27,7 @@
|
|||||||
#define NUMLEDS 1024
|
#define NUMLEDS 1024
|
||||||
|
|
||||||
#ifdef CORE_TEENSY
|
#ifdef CORE_TEENSY
|
||||||
|
#ifdef ENABLE_TEENSY_SMARTMATRIX
|
||||||
#define COLOR_DEPTH 24 // known working: 24, 48 - If the sketch uses type `rgb24` directly, COLOR_DEPTH must be 24
|
#define COLOR_DEPTH 24 // known working: 24, 48 - If the sketch uses type `rgb24` directly, COLOR_DEPTH must be 24
|
||||||
|
|
||||||
const uint8_t kMatrixWidth = 96; // known working: 32, 64, 96, 128
|
const uint8_t kMatrixWidth = 96; // known working: 32, 64, 96, 128
|
||||||
@ -31,26 +42,55 @@ const uint8_t kScrollingLayerOptions = (SM_SCROLLING_OPTIONS_NONE);
|
|||||||
SMARTMATRIX_ALLOCATE_BUFFERS(matrix, kMatrixWidth, kMatrixHeight, kRefreshDepth, kDmaBufferRows, kPanelType, kMatrixOptions);
|
SMARTMATRIX_ALLOCATE_BUFFERS(matrix, kMatrixWidth, kMatrixHeight, kRefreshDepth, kDmaBufferRows, kPanelType, kMatrixOptions);
|
||||||
SMARTMATRIX_ALLOCATE_BACKGROUND_LAYER(backgroundLayer, kMatrixWidth, kMatrixHeight, COLOR_DEPTH, kBackgroundLayerOptions);
|
SMARTMATRIX_ALLOCATE_BACKGROUND_LAYER(backgroundLayer, kMatrixWidth, kMatrixHeight, COLOR_DEPTH, kBackgroundLayerOptions);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
CRGB leds[NUMLEDS];
|
CRGB leds[NUMLEDS];
|
||||||
|
CRGB rainbow[] = {CRGB::Red, CRGB(255, 45, 0), CRGB::Yellow, CRGB::Green, CRGB::Blue, CRGB::Purple};
|
||||||
|
|
||||||
LEDHAL2D* hal2D;
|
LEDHAL2D* hal2D;
|
||||||
|
|
||||||
MatrixAnimation* animation;
|
MatrixAnimation* animation;
|
||||||
|
|
||||||
|
int animationCode = 8;
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
CLEDController* controller = &FastLED.addLeds<NEOPIXEL, 6>(leds, NUMLEDS);
|
CLEDController* controller = &FastLED.addLeds<NEOPIXEL, 6>(leds, NUMLEDS);
|
||||||
|
controller->setCorrection(TypicalLEDStrip);
|
||||||
|
|
||||||
hal2D = new CLEDControllerPhysicalMatrix(controller, "Matrix", ArrangementType::HORIZONTALSCAN, 32, 32);
|
hal2D = new CLEDControllerPhysicalMatrix(controller, "Matrix", ArrangementType::HORIZONTALSCAN, 32, 32);
|
||||||
|
|
||||||
animation = new PlasmaMatrix(hal2D, "Plasma Matrix", 10);
|
if(animationCode == 0) {
|
||||||
|
animation = new PlasmaMatrix(hal2D, "Plasma Matrix", 10);
|
||||||
|
} else if(animationCode == 1) {
|
||||||
|
animation = new AlternateMatrix(hal2D, "Alternate Matrix", 125, rainbow, 6, AlternateType::HORIZONTAL_ALTERNATE);
|
||||||
|
} else if(animationCode == 2) {
|
||||||
|
animation = new CollisionMatrix(hal2D, "Collision Matrix", 125, CRGB(255, 45, 0), CRGB::Green, CollisionType::HORIZONTAL_COLLISION);
|
||||||
|
} else if(animationCode == 3) {
|
||||||
|
//Doesn't work, causing heap corruption
|
||||||
|
animation = new ColorRandomizerMatrix(hal2D, "Color Randomizer Matrix",
|
||||||
|
40, true, 6, rainbow, ColorRandomizerType::HORIZONTAL_COLORRANDOMIZER);
|
||||||
|
} else if(animationCode == 4) {
|
||||||
|
animation = new CycleLightMatrix(hal2D, "Cycle Light Matrix", 100, rainbow, 6, CycleLightType::HORIZONTAL_CYCLELIGHT);
|
||||||
|
} else if(animationCode == 5) {
|
||||||
|
//Doesn't work, unhandled exception?
|
||||||
|
animation = new FireworksMatrix(hal2D, "Fireworks Matrix", 40, rainbow, 6, 6, 15);
|
||||||
|
} else if(animationCode == 6) {
|
||||||
|
//Sort of works, mathematical issues exist when using anything other than full color resolution
|
||||||
|
animation = new FluidColorMatrix(hal2D, "Fluid Color Matrix", 20, FluidColorType::HORIZONTAL_FLUIDCOLOR, FluidColorResolution::QUATER_FLUIDCOLOR);
|
||||||
|
} else if(animationCode == 7) {
|
||||||
|
//Doesn't work, causing heap corruption
|
||||||
|
animation = new RicochetMatrix(hal2D, "Ricochet Matrix", 50, 16, rainbow, 6);
|
||||||
|
} else if(animationCode == 8) {
|
||||||
|
//It works, kinda? It doesn't look like the original version of the animation
|
||||||
|
animation = new CycloneMatrix(hal2D, "Cyclone Matrix", 100, 16, 16, 4, 16, 6, rainbow);
|
||||||
|
}
|
||||||
|
|
||||||
animation->enable();
|
animation->enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
animation->update();
|
animation->update();
|
||||||
|
|
||||||
//hal2D->show();
|
hal2D->show();
|
||||||
|
|
||||||
FastLED.delay(1);
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user