@@ -64,32 +64,6 @@ WebSocketsServer webSocket = WebSocketsServer(81);
64
64
ESP8266HTTPUpdateServer httpUpdater;
65
65
#endif
66
66
67
- #ifdef USE_NEOANIMATIONFX
68
- // ***************************************************************************
69
- // Load libraries / Instanciate NeoAnimationFX library
70
- // ***************************************************************************
71
- // https://github.com/debsahu/NeoAnimationFX
72
- #include < NeoAnimationFX.h>
73
- #define NEOMETHOD NeoPBBGRB800
74
-
75
- NEOMETHOD neoStrip (NUMLEDS);
76
- NeoAnimationFX<NEOMETHOD> strip (neoStrip);
77
-
78
- // Uses Pin RX / GPIO3 (Only pin that is supported, due to hardware limitations)
79
- // NEOMETHOD NeoPBBGRB800 uses GRB config 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
80
- // NEOMETHOD NeoPBBGRB400 uses GRB config 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
81
- // NEOMETHOD NeoPBBRGB800 uses RGB config 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
82
- // NEOMETHOD NeoPBBRGB400 uses RGB config 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
83
-
84
- // Uses Pin D4 / GPIO2 (Only pin that is supported, due to hardware limitations)
85
- // NEOMETHOD NeoPBBGRBU800 uses GRB config 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
86
- // NEOMETHOD NeoPBBGRBU400 uses GRB config 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
87
- // NEOMETHOD NeoPBBRGBU800 uses RGB config 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
88
- // NEOMETHOD NeoPBBRGBU400 uses RGB config 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
89
-
90
- #endif
91
-
92
- #ifdef USE_WS2812FX
93
67
// ***************************************************************************
94
68
// Load libraries / Instanciate WS2812FX library
95
69
// ***************************************************************************
@@ -109,6 +83,23 @@ WS2812FX strip = WS2812FX(NUMLEDS, PIN, NEO_GRB + NEO_KHZ800);
109
83
// pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input
110
84
// and minimize distance between Arduino and first pixel. Avoid connecting
111
85
// on a live circuit...if you must, connect GND first.
86
+
87
+ #ifdef USE_WS2812FX_DMA
88
+ #include < NeoPixelBus.h>
89
+ NeoEsp8266Dma800KbpsMethod dma = NeoEsp8266Dma800KbpsMethod(NUMLEDS, 3 ); // 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
90
+ // NeoEsp8266Dma400KbpsMethod dma = NeoEsp8266Dma400KbpsMethod(NUMLEDS, 3); //400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
91
+ #endif
92
+ #ifdef USE_WS2812FX_UART
93
+ #include < NeoPixelBus.h>
94
+ NeoEsp8266Uart800KbpsMethod dma = NeoEsp8266Uart800KbpsMethod(NUMLEDS, 3 );
95
+ #endif
96
+ #if defined(USE_WS2812FX_DMA) or defined(USE_WS2812FX_UART)
97
+ void DMA_Show (void ) {
98
+ if (dma.IsReadyToUpdate ()) {
99
+ memcpy (dma.getPixels (), strip.getPixels (), dma.getPixelsSize ());
100
+ dma.Update ();
101
+ }
102
+ }
112
103
#endif
113
104
114
105
// ***************************************************************************
@@ -265,6 +256,10 @@ void setup() {
265
256
// Setup: Neopixel
266
257
// ***************************************************************************
267
258
strip.init ();
259
+ #if defined(USE_WS2812FX_DMA) or defined(USE_WS2812FX_UART)
260
+ dma.Initialize ();
261
+ strip.setCustomShow (DMA_Show);
262
+ #endif
268
263
strip.setBrightness (brightness);
269
264
strip.setSpeed (convertSpeed (ws2812fx_speed));
270
265
// strip.setMode(FX_MODE_RAINBOW_CYCLE);
@@ -511,12 +506,15 @@ void setup() {
511
506
json[" core_version" ] = ESP.getCoreVersion ();
512
507
json[" cpu_freq" ] = ESP.getCpuFreqMHz ();
513
508
json[" chip_id" ] = ESP.getFlashChipId ();
514
- #ifndef USE_NEOANIMATIONFX
515
- json[" animation_lib" ] = " WS2812FX" ;
516
- json[" pin" ] = PIN;
509
+ #if defined(USE_WS2812FX_DMA)
510
+ json[" animation_lib" ] = " WS2812FX_DMA" ;
511
+ json[" pin" ] = 3 ;
512
+ #elif defined(USE_WS2812FX_UART)
513
+ json[" animation_lib" ] = " WS2812FX_UART" ;
514
+ json[" pin" ] = 2 ;
517
515
#else
518
- json[" animation_lib" ] = " NeoAnimationFX " ;
519
- json[" pin" ] = " Ignored, check NEOMETHOD " ;
516
+ json[" animation_lib" ] = " WS2812FX " ;
517
+ json[" pin" ] = PIN ;
520
518
#endif
521
519
json[" number_leds" ] = NUMLEDS;
522
520
#ifdef ENABLE_BUTTON
0 commit comments