WS2811 DMA

- Added Settings for WS2811
This commit is contained in:
Debashish Sahu 2019-03-07 12:49:30 -05:00
parent 7539888d6d
commit 6f188d455a
5 changed files with 55 additions and 24 deletions

View file

@ -91,26 +91,49 @@ WS2812FX* strip;
#include <NeoPixelBus.h>
#ifdef USE_WS2812FX_DMA // Uses GPIO3/RXD0/RX, more info: https://github.com/Makuna/NeoPixelBus/wiki/ESP8266-NeoMethods
NeoEsp8266Dma800KbpsMethod* dma;
#ifndef LED_TYPE_WS2811
NeoEsp8266Dma800KbpsMethod* dma; //800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
#else
NeoEsp8266Dma400KbpsMethod* dma; //400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
#endif
#endif
#ifdef USE_WS2812FX_UART1 // Uses UART1: GPIO1/TXD0/TX, more info: https://github.com/Makuna/NeoPixelBus/wiki/ESP8266-NeoMethods
NeoEsp8266Uart0800KbpsMethod* dma;
#ifndef LED_TYPE_WS2811
NeoEsp8266Uart0800KbpsMethod* dma; //800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
#else
NeoEsp8266Uart0400KbpsMethod* dma; //400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
#endif
#endif
#ifdef USE_WS2812FX_UART2 // Uses UART2: GPIO2/TXD1/D4, more info: https://github.com/Makuna/NeoPixelBus/wiki/ESP8266-NeoMethods
NeoEsp8266Uart1800KbpsMethod* dma;
#ifndef LED_TYPE_WS2811
NeoEsp8266Uart1800KbpsMethod* dma; //800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
#else
NeoEsp8266Uart1400KbpsMethod* dma; //400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
#endif
#endif
void initDMA(uint16_t stripSize = NUMLEDS){
if (dma) delete dma;
#ifdef USE_WS2812FX_DMA // Uses GPIO3/RXD0/RX, more info: https://github.com/Makuna/NeoPixelBus/wiki/ESP8266-NeoMethods
#ifndef LED_TYPE_WS2811
dma = new NeoEsp8266Dma800KbpsMethod(stripSize, 3); //800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//NeoEsp8266Dma400KbpsMethod dma = NeoEsp8266Dma400KbpsMethod(NUMLEDS, 3); //400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
#else
dma = new NeoEsp8266Dma400KbpsMethod(stripSize, 3); //400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
#endif
#endif
#ifdef USE_WS2812FX_UART1 // Uses UART1: GPIO1/TXD0/TX, more info: https://github.com/Makuna/NeoPixelBus/wiki/ESP8266-NeoMethods
dma = new NeoEsp8266Uart0800KbpsMethod(stripSize, 3);
#ifndef LED_TYPE_WS2811
dma = new NeoEsp8266Uart0800KbpsMethod(stripSize, 3); //800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
#else
dma = new NeoEsp8266Uart0400KbpsMethod(stripSize, 3); //400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
#endif
#endif
#ifdef USE_WS2812FX_UART2 // Uses UART2: GPIO2/TXD1/D4, more info: https://github.com/Makuna/NeoPixelBus/wiki/ESP8266-NeoMethods
dma = new NeoEsp8266Uart1800KbpsMethod(stripSize, 3);
#ifndef LED_TYPE_WS2811
dma = new NeoEsp8266Uart1800KbpsMethod(stripSize, 3); //800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
#else
dma = new NeoEsp8266Uart1400KbpsMethod(stripSize, 3); //400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
#endif
#endif
dma->Initialize();
}
@ -241,7 +264,11 @@ void initStrip(uint16_t stripSize = WS2812FXStripSettings.stripSize, neoPixelTyp
WS2812FXStripSettings.RGBOrder = RGBOrder;
WS2812FXStripSettings.pin = pin;
}
#ifndef LED_TYPE_WS2811
strip = new WS2812FX(stripSize, pin, RGBOrder + NEO_KHZ800);
#else
strip = new WS2812FX(stripSize, pin, RGBOrder + NEO_KHZ400);
#endif
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:

View file

@ -5,6 +5,7 @@
// Neopixel
#define LED_PIN 14 // LED_PIN (14 / D5) where neopixel / WS2811 strip is attached
#define NUMLEDS 24 // Number of leds in the strip
#define LED_TYPE_WS2811 // Uncomment if LED type uses 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
#define BUILTIN_LED 2 // ESP-12F has the built in LED on GPIO2, see https://github.com/esp8266/Arduino/issues/2192
#define BUTTON 4 // Input pin (4 / D2) for switching the LED strip on / off, connect this PIN to ground to trigger button.

View file

@ -1 +1 @@
#define SKETCH_VERSION "2.2.1"
#define SKETCH_VERSION "2.2.2"

View file

@ -56,11 +56,11 @@
* 23 Dec 2018 v 2.2.0
* - Add E1.31 mode to getModes(), no need to change McLightingUI
*
* 6 Jan 2018 v 2.2.0
* 6 Jan 2019 v 2.2.0
* - fix webserver not responding when E1.31 is mode is acivated: do a webserver.loop() for every 1.31 packet
* - HA E1.31 mode added
*
* 24 Jan 2018 v 2.2.1
* 24 Jan 2019 v 2.2.1
* - checkForRequests() is vital for e131 mode, remove from #ifdef ENABLE_LEGACY_ANIMATIONS
* - Minor fixes related to NeoPixelBus UART methods
* - Modify platformio.ini for future bump to esp8266-arduino v2.5.0 (shamelessly stolen settings from espurna project)
@ -78,4 +78,7 @@
* - Rename varaibles to be char instead of String
* - Added LED pixel count and PIN settings to WiFiManager
* - Gamma correction to LEDs
*
* 7 Mar 2019 v 2.2.2
* - Add compiler flag for WS2811 strips #define LED_TYPE_WS2811
*/

View file

@ -41,7 +41,7 @@ lib_deps =
AsyncMqttClient
https://github.com/bblanchon/ArduinoJson.git#v6.8.0-beta
WS2812FX
NeoPixelBus@2.4.2
NeoPixelBus
WebSockets
ESPAsyncE131
ESPAsyncUDP
@ -50,17 +50,6 @@ lib_deps =
targets_eum = erase, upload, monitor
targets_um = upload, monitor
[env:esp01_1m]
board = esp01_1m
framework = ${common.framework}
platform = ${common.platform}
build_flags = ${common.build_flags} -D D1=2
monitor_speed = ${common.monitor_speed}
upload_speed = ${common.upload_speed}
upload_resetmethod = ${common.upload_resetmethod}
board_build.flash_mode = dout
lib_deps = ${common.lib_deps}
[env:nodemcuv2]
board = nodemcuv2
framework = ${common.framework}
@ -73,3 +62,14 @@ upload_speed = ${common.upload_speed}
upload_resetmethod = ${common.upload_resetmethod}
lib_deps = ${common.lib_deps}
; targets = ${common.targets_um}
[env:esp01_1m]
board = esp01_1m
framework = ${common.framework}
platform = ${common.platform}
build_flags = ${common.build_flags} -D D1=2
monitor_speed = ${common.monitor_speed}
upload_speed = ${common.upload_speed}
upload_resetmethod = ${common.upload_resetmethod}
board_build.flash_mode = dout
lib_deps = ${common.lib_deps}