Skip to content
This repository was archived by the owner on Apr 28, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 36 additions & 9 deletions Arduino/McLighting/McLighting.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
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)
#ifndef LED_TYPE_WS2811
dma = new NeoEsp8266Dma800KbpsMethod(stripSize, 3); //800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
#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();
}
Expand Down Expand Up @@ -241,7 +264,11 @@ void initStrip(uint16_t stripSize = WS2812FXStripSettings.stripSize, neoPixelTyp
WS2812FXStripSettings.RGBOrder = RGBOrder;
WS2812FXStripSettings.pin = pin;
}
strip = new WS2812FX(stripSize, pin, RGBOrder + NEO_KHZ800);
#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:
Expand Down Expand Up @@ -862,7 +889,7 @@ void setup() {

DynamicJsonDocument jsonBuffer(200);
JsonObject json = jsonBuffer.to<JsonObject>();
json["pixel_pount"] = WS2812FXStripSettings.stripSize;
json["pixel_count"] = WS2812FXStripSettings.stripSize;
json["rgb_order"] = WS2812FXStripSettings.RGBOrder;
json["pin"] = WS2812FXStripSettings.pin;
String json_str;
Expand Down
1 change: 1 addition & 0 deletions Arduino/McLighting/definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 3 additions & 1 deletion Arduino/McLighting/request_handlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -1412,7 +1412,9 @@ bool readStateFS() {
main_color.green = json["green"];
main_color.blue = json["blue"];

if(mode != OFF) stateOn = true;
#ifdef ENABLE_HOMEASSISTANT
if(mode != OFF) stateOn = true;
#endif
strip->setMode(ws2812fx_mode);
strip->setSpeed(convertSpeed(ws2812fx_speed));
strip->setBrightness(brightness);
Expand Down
2 changes: 1 addition & 1 deletion Arduino/McLighting/version.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define SKETCH_VERSION "2.2.1"
#define SKETCH_VERSION "2.2.2"
8 changes: 6 additions & 2 deletions Arduino/McLighting/version_info.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -78,4 +78,8 @@
* - 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
* - Hotfix #351
*/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# McLighting v2 - The ESP8266 based multi-client lighting gadget

[![Gitter](https://badges.gitter.im/mclighting/Lobby.svg)](https://gitter.im/mclighting/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Build Status](https://travis-ci.com/toblum/McLighting.svg?branch=master)](https://travis-ci.com/toblum/McLighting) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![version](https://img.shields.io/badge/version-v2.2.1-blue.svg)](https://github.com/toblum/McLighting/blob/master/Arduino/McLighting/version.h)
[![Gitter](https://badges.gitter.im/mclighting/Lobby.svg)](https://gitter.im/mclighting/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Build Status](https://travis-ci.com/toblum/McLighting.svg?branch=master)](https://travis-ci.com/toblum/McLighting) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![version](https://img.shields.io/badge/version-v2.2.2-blue.svg)](https://github.com/toblum/McLighting/blob/master/Arduino/McLighting/version.h)

McLighting (the multi-client lighting gadget) is a very cheap internet-controllable lighting solution based on the famous ESP8266 microcontroller and WS2811/2812 led strips. It features among other things a web-interface, a REST-API and a websocket connector.

Expand Down
24 changes: 12 additions & 12 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -50,26 +50,26 @@ lib_deps =
targets_eum = erase, upload, monitor
targets_um = upload, monitor

[env:esp01_1m]
board = esp01_1m
[env:nodemcuv2]
board = nodemcuv2
framework = ${common.framework}
platform = ${common.platform}
build_flags = ${common.build_flags} -D D1=2
build_flags =
${common.build_flags}
-Wl,-Teagle.flash.4m3m.ld ;;;; Required for core > v2.5.0 or staging version
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}
; targets = ${common.targets_um}

[env:nodemcuv2]
board = nodemcuv2
[env:esp01_1m]
board = esp01_1m
framework = ${common.framework}
platform = ${common.platform}
build_flags =
${common.build_flags}
-Wl,-Teagle.flash.4m3m.ld ;;;; Required for core > v2.5.0 or staging version
build_flags = ${common.build_flags} -D D1=2
monitor_speed = ${common.monitor_speed}
upload_speed = ${common.upload_speed}
upload_resetmethod = ${common.upload_resetmethod}
lib_deps = ${common.lib_deps}
; targets = ${common.targets_um}
board_build.flash_mode = dout
lib_deps = ${common.lib_deps}