From 8a00b69e9e072c09675fd8a97345b8f93b015932 Mon Sep 17 00:00:00 2001 From: Bradley Bickford Date: Mon, 15 Sep 2025 14:56:43 -0400 Subject: [PATCH] Wokwi working, likely going to be limited to 1024 LEDs during testing --- diagram.json | 25 +++++++++++++++++++++++++ src/PlasmaMatrix.cpp | 2 ++ src/main.cpp | 24 ++++++++++++++---------- wokwi.toml | 4 ++++ 4 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 diagram.json create mode 100644 wokwi.toml diff --git a/diagram.json b/diagram.json new file mode 100644 index 0000000..3decc43 --- /dev/null +++ b/diagram.json @@ -0,0 +1,25 @@ +{ + "version": 1, + "author": "Uri Shaked", + "editor": "wokwi", + "parts": [ + { "type": "board-xiao-esp32-s3", "id": "esp", "top": 1000, "left": 13.78, "attrs": {} }, + { + "id": "neopixels", + "type": "wokwi-neopixel-canvas", + "top": 0, + "left": 0, + "attrs": { + "rows": "32", + "cols": "32", + "matrixBrightness": "10" + } + } + ], + "connections": [ + ["esp:GND", "neopixels:VSS", "black"], + ["esp:D5", "neopixels:DIN", "green"], + ["esp:5V", "neopixels:VDD", "red"] + ], + "dependencies": {} +} \ No newline at end of file diff --git a/src/PlasmaMatrix.cpp b/src/PlasmaMatrix.cpp index 989e527..289a1fb 100644 --- a/src/PlasmaMatrix.cpp +++ b/src/PlasmaMatrix.cpp @@ -9,5 +9,7 @@ void PlasmaMatrix::execute() { } } + paletteShift++; + matrix->requestShow(); } \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 22dabce..9d5d0a8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,12 +8,13 @@ #include "FastLED.h" #include "LEDHAL.h" #include "LEDHAL2D.h" +#include "MatrixAnimation.h" +#include "PlasmaMatrix.h" #include "CLEDControllerPhysicalStrip.h" #include "CLEDControllerPhysicalMatrix.h" #include "SmartMatrixPhysicalMatrix.h" -#define NUMLEDS 24 - +#define NUMLEDS 1024 #ifdef CORE_TEENSY #define COLOR_DEPTH 24 // known working: 24, 48 - If the sketch uses type `rgb24` directly, COLOR_DEPTH must be 24 @@ -32,21 +33,24 @@ SMARTMATRIX_ALLOCATE_BACKGROUND_LAYER(backgroundLayer, kMatrixWidth, kMatrixHeig #endif CRGB leds[NUMLEDS]; -CRGB leds2[NUMLEDS]; -CRGB leds3[NUMLEDS]; -CRGB someColor(255, 255, 255); - -LEDHAL* hal; LEDHAL2D* hal2D; -LEDHAL2D* smHAL; + +MatrixAnimation* animation; void setup() { CLEDController* controller = &FastLED.addLeds(leds, NUMLEDS); - hal = new CLEDControllerPhysicalStrip(controller, "Test Strip"); + hal2D = new CLEDControllerPhysicalMatrix(controller, "Matrix", ArrangementType::HORIZONTALSCAN, 32, 32); + + animation = new PlasmaMatrix(hal2D, "Plasma Matrix", 10); + animation->enable(); } void loop() { - // put your main code here, to run repeatedly: + animation->update(); + + //hal2D->show(); + + FastLED.delay(1); } diff --git a/wokwi.toml b/wokwi.toml new file mode 100644 index 0000000..62a5d76 --- /dev/null +++ b/wokwi.toml @@ -0,0 +1,4 @@ +[wokwi] +version = 1 +firmware = '.pio/build/esp32/firmware.bin' +elf = '.pio/build/esp32/firmware.elf' \ No newline at end of file