Skip to content
This repository was archived by the owner on Apr 28, 2022. It is now read-only.

Commit 2bb2943

Browse files
authored
Merge pull request #265 from toblum/develop
v 2.1.6
2 parents e19ec28 + ac5e873 commit 2bb2943

10 files changed

+604
-137
lines changed

.gitmodules

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "Arduino/McLighting/data/McLightingUI"]
2+
path = Arduino/McLighting/data/McLightingUI
3+
url = https://github.com/toblum/McLightingUI
4+
[submodule "clients/web/McLightingUI"]
5+
path = clients/web/McLightingUI
6+
url = https://github.com/toblum/McLightingUI

Arduino/McLighting/McLighting.ino

+29-31
Original file line numberDiff line numberDiff line change
@@ -64,32 +64,6 @@ WebSocketsServer webSocket = WebSocketsServer(81);
6464
ESP8266HTTPUpdateServer httpUpdater;
6565
#endif
6666

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
9367
// ***************************************************************************
9468
// Load libraries / Instanciate WS2812FX library
9569
// ***************************************************************************
@@ -109,6 +83,23 @@ WS2812FX strip = WS2812FX(NUMLEDS, PIN, NEO_GRB + NEO_KHZ800);
10983
// pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input
11084
// and minimize distance between Arduino and first pixel. Avoid connecting
11185
// 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+
}
112103
#endif
113104

114105
// ***************************************************************************
@@ -265,6 +256,10 @@ void setup() {
265256
// Setup: Neopixel
266257
// ***************************************************************************
267258
strip.init();
259+
#if defined(USE_WS2812FX_DMA) or defined(USE_WS2812FX_UART)
260+
dma.Initialize();
261+
strip.setCustomShow(DMA_Show);
262+
#endif
268263
strip.setBrightness(brightness);
269264
strip.setSpeed(convertSpeed(ws2812fx_speed));
270265
//strip.setMode(FX_MODE_RAINBOW_CYCLE);
@@ -511,12 +506,15 @@ void setup() {
511506
json["core_version"] = ESP.getCoreVersion();
512507
json["cpu_freq"] = ESP.getCpuFreqMHz();
513508
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;
517515
#else
518-
json["animation_lib"] = "NeoAnimationFX";
519-
json["pin"] = "Ignored, check NEOMETHOD";
516+
json["animation_lib"] = "WS2812FX";
517+
json["pin"] = PIN;
520518
#endif
521519
json["number_leds"] = NUMLEDS;
522520
#ifdef ENABLE_BUTTON

0 commit comments

Comments
 (0)