Skip to content

Commit

Permalink
Attempted to mitigate flickering on ESP32
Browse files Browse the repository at this point in the history
Replaced broken effect 34, now a quad-color running effect
Added new binaries and guide
Updated readme
  • Loading branch information
Aircoookie committed Jan 10, 2018
1 parent e83ea97 commit 45430aa
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 94 deletions.
18 changes: 18 additions & 0 deletions bin/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
### What binary should I choose?

Currently WLED supports the ESP8266 and a very early, experimental version of ESP32 support.
Be sure to choose the correct binary for your platform and LED type.

- Do you have a standard RGB WS2812B NeoPixel strip?
--> Use wled05dev_XXXXXXX_RGB_PLATFORM.bin

- Do you have an RGBW SK6812 strip (half of the LED is white)?
--> Use wled05dev_XXXXXXX_RGBW_PLATFORM.bin

- Do you have a Cronixie clock set by Diamex?
--> Use wled05dev_XXXXXXX_CRONIXIE_PLATFORM.bin


### What about wled03 and wled04?

These are legacy releases only for the ESP8266. They don't include the latest features and may have unfixed bugs - only use them if the new wled05dev test builds don't work for you!
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
40 changes: 11 additions & 29 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
## Welcome to my project WLED!

WLED is a basic, fast and (relatively) secure implementation of a ESP8266 webserver to control Neopixel (WS2812B) leds
WLED is a fast and (relatively) secure implementation of an ESP8266 webserver to control NeoPixel (WS2812B) LEDs!
Now also with experimental ESP32 support.

Uses ESP Arduino core version 2.3.0 (latest as of December 2017).

### Features: (V0.4)
### Features: (V0.5dev)
- RGB, HSB, and brightness sliders
- Settings page - configuration over network
- Access Point and station mode - automatic failsafe AP
Expand All @@ -16,53 +17,34 @@ Uses ESP Arduino core version 2.3.0 (latest as of December 2017).
- Notifier function (multiple ESPs sync color via UDP broadcast)
- Support for power pushbutton
- Custom Theater Chase
- Full OTA software update capability
- Full OTA software update capability (only ESP8266)
- Password protected OTA page for added security (OTA lock)
- Alexa smart home device server
- Alexa smart home device server (including dimming)
- NTP and experimental analog clock function
- Support for the Cronixie Clock kit by Diamex
- Realtime UDP Packet Control (WARLS) possible
- client HTML controlled
- Edit page. Change html and other files via OTA. (needs to be enabled in source)
- Client HTML UI controlled

### Compile settings:
- Board: WeMos D1 mini (untested with other HW, should work though)
- CPU frequency: 80 MHz
- Flash size : 4MB (3MB SPIFFS)
- Upload speed: 921600

### Quick start guide:
### Quick start guide and documentation:

- If you do not plan to change the software, you can use the supplied binary files instead-
Just flash a [basic HTTP OTA updater](https://github.com/Aircoookie/ESP8266MinimalHTTPUpdater) sketch and upload the bin!

1. Connect a WS2812B RGB led strip to GPIO2. Optionally connect a NO-pushbutton to GPIO0 (internal pull-up) and ground.

2. Follow a guide to setup your Arduino client (I am using version 1.8.1) with the ESP8266 libraries.
For current compiles I use version 2.3.0.

3. In file "wled00.ino", you should change the access point and OTA update passphrases for added security (you can change them later, this is just the "factory default"). Flash the sketch.
You will need to install the NeoPixelBus library by Makuna. All other dependencies are included with WLED for convenience.

5. Connect to automatically started WiFi access point "WLED-AP" using default passwort "wled1234". Go to the IP "192.168.4.1".

6. Click on the cog icon to edit settings like connecting the module to your home WiFi.

7. Have fun with the software!

### Advanced module control via HTTP requests API or UDP:

See the [wiki](https://github.com/Aircoookie/WLED/wiki/HTTP-request-API)!
See the [wiki](https://github.com/Aircoookie/WLED/wiki)!

### Other

Licensed under the MIT license
Uses libraries:
ESP8266 Arduino Core
ESP8266/ESP32 Arduino Core
NeoPixelBus by Makuna
[WS2812FX](https://github.com/kitesurfer1404/WS2812FX) by kitesurfer1404 (Aircoookie fork)
Time library
Timezone library by JChristensen
arduino-esp8266-alexa-multiple-wemo-switch by kakopappa
Alexa code based on arduino-esp8266-alexa-multiple-wemo-switch by kakopappa

Uses Linearicons by Perxis! (link in settings page)

Expand Down
63 changes: 29 additions & 34 deletions wled00/WS2812FX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -990,43 +990,38 @@ void WS2812FX::mode_chase_rainbow_white(void) {


/*
* Eye (broken)
* Red - Amber - Green - Blue lights running
*/
void WS2812FX::mode_icu(void) {
uint16_t dest = _counter_mode_step & 0xFFFF;

setPixelColor(dest, _color);
setPixelColor(dest + _led_count/2, _color);

if(_mode_color == dest) { // pause between eye movements
if(random(6) == 0) { // blink once in a while
setPixelColor(dest, _color_sec);
setPixelColor(dest + _led_count/2, _color_sec);
show();
_mode_delay = 200;
return;
}
_mode_color = random(_led_count/2);
_mode_delay = 1000 + random(2000);
return;
void WS2812FX::mode_colorful(void) {
uint32_t cols[]{0x00FF0000,0x00EEBB00,0x0000EE00,0x000077CC,0x00FF0000,0x00EEBB00,0x0000EE00};
int i = 0;
for (i; i < _led_count-3 ; i+=4)
{
if(!_locked[i])setPixelColor(i, cols[_counter_mode_step]);
if(!_locked[i+1])setPixelColor(i+1, cols[_counter_mode_step+1]);
if(!_locked[i+2])setPixelColor(i+2, cols[_counter_mode_step+2]);
if(!_locked[i+3])setPixelColor(i+3, cols[_counter_mode_step+3]);
}

setPixelColor(dest, _color_sec);
setPixelColor(dest + _led_count/2, _color_sec);

if(_mode_color > _counter_mode_step) {
_counter_mode_step++;
dest++;
} else if (_mode_color < _counter_mode_step) {
_counter_mode_step--;
dest--;
i+=4;
if(i < _led_count && !_locked[i])
{
setPixelColor(i, cols[_counter_mode_step]);

if(i+1 < _led_count && !_locked[i+1])
{
setPixelColor(i+1, cols[_counter_mode_step+1]);

if(i+2 < _led_count && !_locked[i+2])
{
setPixelColor(i+2, cols[_counter_mode_step+2]);
}
}
}

setPixelColor(dest, _color);
setPixelColor(dest + _led_count/2, _color);

show();

_mode_delay = 100 + ((100 * (uint32_t)(SPEED_MAX - _speed)) / _led_count);
if (_speed > SPEED_MIN) _counter_mode_step++; //static if lowest speed
if (_counter_mode_step >3) _counter_mode_step = 0;
_mode_delay = 100 + (25 * (uint32_t)(SPEED_MAX - _speed));
}


Expand Down Expand Up @@ -2037,8 +2032,8 @@ void WS2812FX::show()
{
#ifdef ARDUINO_ARCH_ESP32
portDISABLE_INTERRUPTS();
NeoPixelBrightnessBus::Show();
delay(1);
NeoPixelBrightnessBus::Show();
portENABLE_INTERRUPTS();
#else
NeoPixelBrightnessBus::Show();
Expand Down
51 changes: 21 additions & 30 deletions wled00/WS2812FX.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
//#define RGBW
#define PIN 2 //strip pin. Only for ESP32
#define PIN 2 //strip pin. Only change for ESP32

//automatically uses the right driver method for each platform
#ifdef ARDUINO_ARCH_ESP32
#define PIXELMETHOD NeoWs2813Method
#else
#define PIXELMETHOD NeoEsp8266Uart800KbpsMethod
#endif

//selects correct feature for RGB/RGBW
#ifdef RGBW
#define PIXELFEATURE NeoGrbwFeature
#else
#define PIXELFEATURE NeoGrbFeature
#endif

/*
WS2812FX.h - Library for WS2812 LED effects.
Expand Down Expand Up @@ -86,7 +100,7 @@
#define FX_MODE_CHASE_FLASH 31
#define FX_MODE_CHASE_FLASH_RANDOM 32
#define FX_MODE_CHASE_RAINBOW_WHITE 33
#define FX_MODE_ICU 34
#define FX_MODE_COLORFUL 34
#define FX_MODE_TRAFFIC_LIGHT 35
#define FX_MODE_COLOR_SWEEP_RANDOM 36
#define FX_MODE_RUNNING_COLOR 37
Expand All @@ -111,35 +125,12 @@
#define FX_MODE_CC_BLINK 56
#define FX_MODE_CC_RANDOM 57

#ifdef ARDUINO_ARCH_ESP32
#ifdef RGBW
class WS2812FX : public NeoPixelBrightnessBus<NeoGrbwFeature, Neo800KbpsMethod> {
#else
class WS2812FX : public NeoPixelBrightnessBus<NeoGrbFeature, Neo800KbpsMethod> {
#endif
typedef void (WS2812FX::*mode_ptr)(void);

public:
#ifdef RGBW
WS2812FX(uint16_t n) : NeoPixelBrightnessBus<NeoGrbwFeature, Neo800KbpsMethod>(n, PIN) {
#else
WS2812FX(uint16_t n) : NeoPixelBrightnessBus<NeoGrbFeature, Neo800KbpsMethod>(n, PIN) {
#endif
#else //ESP8266
#ifdef RGBW
class WS2812FX : public NeoPixelBrightnessBus<NeoGrbwFeature, NeoEsp8266Uart800KbpsMethod> {
#else
class WS2812FX : public NeoPixelBrightnessBus<NeoGrbFeature, NeoEsp8266Uart800KbpsMethod> {
#endif
class WS2812FX : public NeoPixelBrightnessBus<PIXELFEATURE, PIXELMETHOD> {
typedef void (WS2812FX::*mode_ptr)(void);

public:
#ifdef RGBW
WS2812FX(uint16_t n) : NeoPixelBrightnessBus<NeoGrbwFeature, NeoEsp8266Uart800KbpsMethod>(n) {
#else
WS2812FX(uint16_t n) : NeoPixelBrightnessBus<NeoGrbFeature, NeoEsp8266Uart800KbpsMethod>(n) {
#endif
#endif
WS2812FX(uint16_t n) : NeoPixelBrightnessBus<PIXELFEATURE, PIXELMETHOD>(n,PIN) {

_mode[FX_MODE_STATIC] = &WS2812FX::mode_static;
_mode[FX_MODE_BLINK] = &WS2812FX::mode_blink;
_mode[FX_MODE_BREATH] = &WS2812FX::mode_breath;
Expand Down Expand Up @@ -174,7 +165,7 @@ class WS2812FX : public NeoPixelBrightnessBus<NeoGrbFeature, NeoEsp8266Uart800Kb
_mode[FX_MODE_CHASE_FLASH] = &WS2812FX::mode_chase_flash;
_mode[FX_MODE_CHASE_FLASH_RANDOM] = &WS2812FX::mode_chase_flash_random;
_mode[FX_MODE_CHASE_RAINBOW_WHITE] = &WS2812FX::mode_chase_rainbow_white;
_mode[FX_MODE_ICU] = &WS2812FX::mode_icu;
_mode[FX_MODE_COLORFUL] = &WS2812FX::mode_colorful;
_mode[FX_MODE_TRAFFIC_LIGHT] = &WS2812FX::mode_traffic_light;
_mode[FX_MODE_COLOR_SWEEP_RANDOM] = &WS2812FX::mode_color_sweep_random;
_mode[FX_MODE_RUNNING_COLOR] = &WS2812FX::mode_running_color;
Expand Down Expand Up @@ -337,7 +328,7 @@ class WS2812FX : public NeoPixelBrightnessBus<NeoGrbFeature, NeoEsp8266Uart800Kb
mode_chase_flash(void),
mode_chase_flash_random(void),
mode_chase_rainbow_white(void),
mode_icu(void),
mode_colorful(void),
mode_traffic_light(void),
mode_color_sweep_random(void),
mode_running_color(void),
Expand Down
2 changes: 1 addition & 1 deletion wled00/wled00.ino
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "WS2812FX.h"

//version in format yymmddb (b = daily build)
#define VERSION 1801101
#define VERSION 1801102
const String versionName = "WLED 0.5dev";

//AP and OTA default passwords (change them!)
Expand Down

0 comments on commit 45430aa

Please sign in to comment.