Merge pull request #27 from Aircoookie/master

Update
This commit is contained in:
srg74 2020-02-18 19:46:45 -05:00 committed by GitHub
commit 036bd07e72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 2659 additions and 2446 deletions

View File

@ -80,6 +80,7 @@ arduino_core_2_6_2 = espressif8266@2.3.1
arduino_core_stage = https://github.com/platformio/platform-espressif8266.git#feature/stage
platform = ${common:esp8266.arduino_core_2_6_2}
build_flags =
-D ESP8266
-D PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH
-Wl,-Teagle.flash.4m1m.ld ;;;; Required for core > v2.5.0 or staging version 4MB Flash 3MB SPIFFs
@ -127,6 +128,8 @@ build_flags =
${common:esp8266.build_flags}
lib_deps =
${common.lib_deps_external}
lib_compat_mode = strict
lib_ignore = AsynTCP
[env:d1_mini]
board = d1_mini
@ -139,6 +142,8 @@ build_flags =
${common:esp8266.build_flags}
lib_deps =
${common.lib_deps_external}
lib_compat_mode = strict
lib_ignore = AsynTCP
[env:esp01_1m]
board = esp01_1m
@ -153,6 +158,8 @@ build_flags =
-D WLED_DISABLE_INFRARED
lib_deps =
${common.lib_deps_external}
lib_compat_mode = strict
lib_ignore = AsynTCP
[env:esp01]
board = esp01
@ -166,6 +173,8 @@ build_flags =
-D WLED_DISABLE_INFRARED
lib_deps =
${common.lib_deps_external}
lib_compat_mode = strict
lib_ignore = AsynTCP
[env:esp07]
board = esp07
@ -178,6 +187,8 @@ build_flags =
${common:esp8266.build_flags}
lib_deps =
${common.lib_deps_external}
lib_compat_mode = strict
lib_ignore = AsynTCP
# see: http://docs.platformio.org/en/latest/platforms/espressif32.html
[env:esp32dev]
@ -193,6 +204,7 @@ lib_deps =
${common.lib_deps_external}
lib_ignore =
ESPAsyncUDP
lib_compat_mode = strict
[env:esp8285_4CH_MagicHome]
board = esp8285
@ -207,6 +219,8 @@ build_flags =
-D WLED_USE_ANALOG_LEDS
lib_deps =
${common.lib_deps_external}
lib_compat_mode = strict
lib_ignore = AsynTCP
[env:esp8285_4CH_H801]
board = esp8285
@ -222,6 +236,8 @@ build_flags =
-D WLED_USE_H801
lib_deps =
${common.lib_deps_external}
lib_compat_mode = strict
lib_ignore = AsynTCP
[env:esp8285_5CH_H801]
board = esp8285
@ -238,4 +254,6 @@ build_flags =
-D WLED_ENABLE_5CH_LEDS
lib_deps =
${common.lib_deps_external}
lib_compat_mode = strict
lib_ignore = AsynTCP

View File

@ -1219,11 +1219,10 @@ uint16_t WS2812FX::mode_loading(void) {
//American Police Light with all LEDs Red and Blue
uint16_t WS2812FX::police_base(uint32_t color1, uint32_t color2)
uint16_t WS2812FX::police_base(uint32_t color1, uint32_t color2, bool all)
{
uint16_t counter = now * ((SEGMENT.speed >> 2) +1);
uint16_t idexR = (counter * SEGLEN) >> 16;
uint8_t size = 1 + SEGMENT.intensity >> 3;
if (idexR >= SEGLEN) idexR = 0;
uint16_t topindex = SEGLEN >> 1;
@ -1231,19 +1230,31 @@ uint16_t WS2812FX::police_base(uint32_t color1, uint32_t color2)
if (SEGENV.call == 0) SEGENV.aux0 = idexR;
if (idexB >= SEGLEN) idexB = 0; //otherwise overflow on odd number of LEDs
for (uint8_t i=0; i <= size; i++) {
setPixelColor(idexR+i, color1);
setPixelColor(idexB+i, color2);
}
if (SEGENV.aux0 != idexR) {
uint8_t gap = (SEGENV.aux0 < idexR)? idexR - SEGENV.aux0:SEGLEN - SEGENV.aux0 + idexR;
for (uint8_t i = 0; i <= gap ; i++) {
if ((idexR - i) < 0) idexR = SEGLEN-1 + i;
if ((idexB - i) < 0) idexB = SEGLEN-1 + i;
setPixelColor(idexR-i, color1);
setPixelColor(idexB-i, color2);
if (all) { //different algo, ensuring immediate fill
if (idexB > idexR) {
fill(color2);
for (uint16_t i = idexR; i < idexB; i++) setPixelColor(i, color1);
} else {
fill(color1);
for (uint16_t i = idexB; i < idexR; i++) setPixelColor(i, color2);
}
} else { //regular dot-only mode
uint8_t size = 1 + SEGMENT.intensity >> 3;
if (size > SEGLEN/2) size = 1+ SEGLEN/2;
for (uint8_t i=0; i <= size; i++) {
setPixelColor(idexR+i, color1);
setPixelColor(idexB+i, color2);
}
if (SEGENV.aux0 != idexR) {
uint8_t gap = (SEGENV.aux0 < idexR)? idexR - SEGENV.aux0:SEGLEN - SEGENV.aux0 + idexR;
for (uint8_t i = 0; i <= gap ; i++) {
if ((idexR - i) < 0) idexR = SEGLEN-1 + i;
if ((idexB - i) < 0) idexB = SEGLEN-1 + i;
setPixelColor(idexR-i, color1);
setPixelColor(idexB-i, color2);
}
SEGENV.aux0 = idexR;
}
SEGENV.aux0 = idexR;
}
return FRAMETIME;
@ -1253,7 +1264,7 @@ uint16_t WS2812FX::police_base(uint32_t color1, uint32_t color2)
//American Police Light with all LEDs Red and Blue
uint16_t WS2812FX::mode_police_all()
{
return police_base(RED, BLUE);
return police_base(RED, BLUE, true);
}
@ -1262,14 +1273,14 @@ uint16_t WS2812FX::mode_police()
{
fill(SEGCOLOR(1));
return police_base(RED, BLUE);
return police_base(RED, BLUE, false);
}
//Police All with custom colors
uint16_t WS2812FX::mode_two_areas()
{
return police_base(SEGCOLOR(0), SEGCOLOR(1));
return police_base(SEGCOLOR(0), SEGCOLOR(1), true);
}
@ -1279,7 +1290,7 @@ uint16_t WS2812FX::mode_two_dots()
fill(SEGCOLOR(2));
uint32_t color2 = (SEGCOLOR(1) == SEGCOLOR(2)) ? SEGCOLOR(0) : SEGCOLOR(1);
return police_base(SEGCOLOR(0), color2);
return police_base(SEGCOLOR(0), color2, false);
}
@ -1327,22 +1338,23 @@ uint16_t WS2812FX::mode_tricolor_chase(void) {
*/
uint16_t WS2812FX::mode_icu(void) {
uint16_t dest = SEGENV.step & 0xFFFF;
uint8_t space = (SEGMENT.intensity >> 3) +2;
fill(SEGCOLOR(1));
byte pindex = map(dest, 0, SEGLEN/2, 0, 255);
byte pindex = map(dest, 0, SEGLEN-SEGLEN/space, 0, 255);
uint32_t col = color_from_palette(pindex, false, false, 0);
setPixelColor( dest, col);
setPixelColor( dest + SEGLEN/2, col);
setPixelColor(dest, col);
setPixelColor(dest + SEGLEN/space, col);
if(SEGENV.aux0 == dest) { // pause between eye movements
if(random8(6) == 0) { // blink once in a while
setPixelColor( dest, SEGCOLOR(1));
setPixelColor( dest + SEGLEN/2, SEGCOLOR(1));
setPixelColor(dest, SEGCOLOR(1));
setPixelColor(dest + SEGLEN/space, SEGCOLOR(1));
return 200;
}
SEGENV.aux0 = random16(SEGLEN/2);
SEGENV.aux0 = random16(SEGLEN-SEGLEN/space);
return 1000 + random16(2000);
}
@ -1355,7 +1367,7 @@ uint16_t WS2812FX::mode_icu(void) {
}
setPixelColor(dest, col);
setPixelColor(dest + SEGLEN/2, col);
setPixelColor(dest + SEGLEN/space, col);
return SPEED_FORMULA_L;
}
@ -1451,13 +1463,14 @@ uint16_t WS2812FX::mode_tricolor_fade(void)
*/
uint16_t WS2812FX::mode_multi_comet(void)
{
uint32_t cycleTime = 20 + (2 * (uint32_t)(255 - SEGMENT.speed));
uint32_t cycleTime = 10 + (uint32_t)(255 - SEGMENT.speed);
uint32_t it = now / cycleTime;
if (SEGENV.step == it) return FRAMETIME;
if (!SEGENV.allocateData(sizeof(uint16_t) * 8)) return mode_static(); //allocation failed
fade_out(SEGMENT.intensity);
static uint16_t comets[] = {UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX};
uint16_t* comets = reinterpret_cast<uint16_t*>(SEGENV.data);
for(uint8_t i=0; i < 8; i++) {
if(comets[i] < SEGLEN) {
@ -1566,7 +1579,7 @@ uint16_t WS2812FX::mode_oscillate(void)
uint32_t color = BLACK;
for(uint8_t j=0; j < numOscillators; j++) {
if(i >= oscillators[j].pos - oscillators[j].size && i <= oscillators[j].pos + oscillators[j].size) {
color = (color == BLACK) ? SEGMENT.colors[j] : color_blend(color, SEGMENT.colors[j], 128);
color = (color == BLACK) ? SEGCOLOR(j) : color_blend(color, SEGCOLOR(j), 128);
}
}
setPixelColor(i, color);
@ -2133,7 +2146,7 @@ typedef struct Ripple {
uint16_t pos;
} ripple;
uint16_t WS2812FX::mode_ripple()
uint16_t WS2812FX::ripple_base(bool rainbow)
{
uint16_t maxRipples = 1 + (SEGLEN >> 2);
if (maxRipples > 100) maxRipples = 100;
@ -2143,8 +2156,25 @@ uint16_t WS2812FX::mode_ripple()
Ripple* ripples = reinterpret_cast<Ripple*>(SEGENV.data);
fill(SEGCOLOR(1));
// ranbow background or chosen background, all very dim.
if (rainbow) {
if (SEGENV.call ==0) {
SEGENV.aux0 = random8();
SEGENV.aux1 = random8();
}
if (SEGENV.aux0 == SEGENV.aux1) {
SEGENV.aux1 = random8();
}
else if (SEGENV.aux1 > SEGENV.aux0) {
SEGENV.aux0++;
} else {
SEGENV.aux0--;
}
fill(color_blend(color_wheel(SEGENV.aux0),BLACK,235));
} else {
fill(SEGCOLOR(1));
}
//draw wave
for (uint16_t i = 0; i < maxRipples; i++)
{
@ -2188,6 +2218,15 @@ uint16_t WS2812FX::mode_ripple()
return FRAMETIME;
}
uint16_t WS2812FX::mode_ripple(void) {
return ripple_base(false);
}
uint16_t WS2812FX::mode_ripple_rainbow(void) {
return ripple_base(true);
}
// TwinkleFOX by Mark Kriegsman: https://gist.github.com/kriegsman/756ea6dcae8e30845b5a
//
@ -3060,8 +3099,8 @@ uint16_t WS2812FX::mode_percent(void) {
uint16_t active_leds = (percent < 100) ? SEGLEN * percent / 100.0
: SEGLEN * (200 - percent) / 100.0;
if (SEGENV.call == 0) SEGENV.step = 0;
uint8_t size = (1 + ((SEGMENT.speed * SEGLEN) >> 11)) & 0xFF ;
uint8_t size = (1 + ((SEGMENT.speed * SEGLEN) >> 11));
if (SEGMENT.speed == 255) size = 255;
if (percent < 100) {
for (uint16_t i = 0; i < SEGLEN; i++) {
@ -3092,4 +3131,34 @@ uint16_t WS2812FX::mode_percent(void) {
}
return FRAMETIME;
}
/*
/ Modulates the brightness similar to a heartbeat
*/
uint16_t WS2812FX::mode_heartbeat(void) {
uint8_t bpm = 40 + (SEGMENT.speed >> 4);
uint32_t msPerBeat = (60000 / bpm);
uint32_t secondBeat = (msPerBeat / 3);
uint32_t bri_lower = SEGENV.aux1;
bri_lower = bri_lower * 2042 / (2048 + SEGMENT.intensity);
SEGENV.aux1 = bri_lower;
unsigned long beatTimer = millis() - SEGENV.step;
if((beatTimer > secondBeat) && !SEGENV.aux0) { // time for the second beat?
SEGENV.aux1 = UINT16_MAX; //full bri
SEGENV.aux0 = 1;
}
if(beatTimer > msPerBeat) { // time to reset the beat timer?
SEGENV.aux1 = UINT16_MAX; //full bri
SEGENV.aux0 = 0;
SEGENV.step = millis();
}
for (uint16_t i = 0; i < SEGLEN; i++) {
setPixelColor(i, color_blend(color_from_palette(i, true, PALETTE_SOLID_WRAP, 0), SEGCOLOR(1), 255 - (SEGENV.aux1 >> 8)));
}
return FRAMETIME;
}

View File

@ -91,7 +91,7 @@
#define IS_REVERSE ((SEGMENT.options & REVERSE ) == REVERSE )
#define IS_SELECTED ((SEGMENT.options & SELECTED) == SELECTED )
#define MODE_COUNT 99
#define MODE_COUNT 101
#define FX_MODE_STATIC 0
#define FX_MODE_BLINK 1
@ -192,6 +192,8 @@
#define FX_MODE_DRIP 96
#define FX_MODE_PLASMA 97
#define FX_MODE_PERCENT 98
#define FX_MODE_RIPPLE_RAINBOW 99
#define FX_MODE_HEARTBEAT 100
class WS2812FX {
typedef uint16_t (WS2812FX::*mode_ptr)(void);
@ -379,6 +381,8 @@ class WS2812FX {
_mode[FX_MODE_DRIP] = &WS2812FX::mode_drip;
_mode[FX_MODE_PLASMA] = &WS2812FX::mode_plasma;
_mode[FX_MODE_PERCENT] = &WS2812FX::mode_percent;
_mode[FX_MODE_RIPPLE_RAINBOW] = &WS2812FX::mode_ripple_rainbow;
_mode[FX_MODE_HEARTBEAT] = &WS2812FX::mode_heartbeat;
_brightness = DEFAULT_BRIGHTNESS;
currentPalette = CRGBPalette16(CRGB::Black);
@ -562,7 +566,9 @@ class WS2812FX {
mode_popcorn(void),
mode_drip(void),
mode_plasma(void),
mode_percent(void);
mode_percent(void),
mode_ripple_rainbow(void),
mode_heartbeat(void);
private:
@ -607,7 +613,8 @@ class WS2812FX {
dissolve(uint32_t),
chase(uint32_t, uint32_t, uint32_t, bool),
gradient_base(bool),
police_base(uint32_t, uint32_t),
ripple_base(bool),
police_base(uint32_t, uint32_t, bool),
running(uint32_t, uint32_t),
tricolor_chase(uint32_t, uint32_t),
twinklefox_base(bool),
@ -642,7 +649,8 @@ const char JSON_mode_names[] PROGMEM = R"=====([
"Scanner Dual","Stream 2","Oscillate","Pride 2015","Juggle","Palette","Fire 2012","Colorwaves","Bpm","Fill Noise",
"Noise 1","Noise 2","Noise 3","Noise 4","Colortwinkles","Lake","Meteor","Meteor Smooth","Railway","Ripple",
"Twinklefox","Twinklecat","Halloween Eyes","Solid Pattern","Solid Pattern Tri","Spots","Spots Fade","Glitter","Candle","Fireworks Starburst",
"Fireworks 1D","Bouncing Balls","Sinelon","Sinelon Dual","Sinelon Rainbow","Popcorn","Drip","Plasma","Percent"
"Fireworks 1D","Bouncing Balls","Sinelon","Sinelon Dual","Sinelon Rainbow","Popcorn","Drip","Plasma","Percent","Ripple Rainbow",
"Heartbeat"
])=====";

View File

@ -125,9 +125,12 @@ void WS2812FX::setPixelColor(uint16_t i, byte r, byte g, byte b, byte w)
/* Set all the pixels in the group, ensuring _skipFirstMode is honored */
bool reversed = reverseMode ^ IS_REVERSE;
uint16_t realIndex = realPixelIndex(i);
for (uint16_t j = 0; j < SEGMENT.grouping; j++) {
int16_t indexSet = realIndex + (reversed ? -j : j);
if (indexSet >= SEGMENT.start && indexSet < SEGMENT.stop) bus->SetPixelColor(indexSet + skip, col);
int16_t indexSetRev = indexSet;
if (reverseMode) indexSetRev = _length - 1 - indexSet;
if (indexSetRev >= SEGMENT.start && indexSetRev < SEGMENT.stop) bus->SetPixelColor(indexSet + skip, col);
}
} else { //live data, etc.
if (reverseMode) i = _length - 1 - i;

View File

@ -287,6 +287,15 @@ public:
return 0;
}
uint8_t* GetPixels(void)
{
switch (_type) {
case NeoPixelType_Grb: return _pGrb->Pixels(); break;
case NeoPixelType_Grbw: return _pGrbw->Pixels(); break;
}
return 0;
}
private:
NeoPixelType _type;

File diff suppressed because one or more lines are too long

View File

@ -189,7 +189,16 @@ const char PAGE_settings_sync[] PROGMEM = R"=====(<!DOCTYPE html>
<h2>Sync setup</h2>
<h3>Button setup</h3>
On/Off button enabled: <input type="checkbox" name="BT"><br>
Infrared receiver type (0 = disabled): <input name="IR" type="number" min="0" max="6" required><br>
Infrared remote:
<select name=IR>
<option value=0>Disabled</option>
<option value=1>24-key RGB</option>
<option value=2>24-key with CT</option>
<option value=3>40-key blue</option>
<option value=4>44-key RGB</option>
<option value=5>21-key RGB</option>
<option value=6>6-key black</option>
</select><br>
<a href="https://github.com/Aircoookie/WLED/wiki/Infrared-Control" target="_blank">IR info</a>
<h3>WLED Broadcast</h3>
UDP Port: <input name="UP" type="number" min="1" max="65535" required><br>
@ -207,12 +216,16 @@ Use E1.31 multicast: <input type="checkbox" name="EM"><br>
E1.31 start universe: <input name="EU" type="number" min="1" max="63999" required><br>
<i>Reboot required.</i> Check out <a href="https://github.com/ahodges9/LedFx" target="_blank">LedFx</a>!<br>
DMX start address: <input name="DA" type="number" min="1" max="510" value="1" required><br>
DMX mode: <input name="DM" type="radio" value="0"> disabled<br>
<input name="DM" type="radio" value="1"> Single RGB (3 Channels for all LEDs: Red Green Blue)<br>
<input name="DM" type="radio" value="2"> Single DRGB (4 Channels for all LEDs: Dimmer Red Green Blue)<br>
<input name="DM" type="radio" value="3"> Effect (11 Channels for properties: Dimmer FX Speed Intensity Palette PriR PriG PriB SecR SecG SecB)<br>
<input name="DM" type="radio" value="4"> Multiple RGB (3 Channels for each LED: Red Green Blue)<br>
<input name="DM" type="radio" value="5"> Multiple DRGB (1+3 Channels for each LED: Dimmer R1 G1 B1 R2 G2 B2...)<br><br>
DMX mode:
<select name=DM>
<option value=0>Disabled</option>
<option value=1>Single RGB</option>
<option value=2>Single DRGB</option>
<option value=3>Effect</option>
<option value=4>Multi RGB</option>
<option value=5>Multi DRGB</option>
</select><br>
<a href="https://github.com/Aircoookie/WLED/wiki/E1.31-DMX" target="_blank">E1.31 info</a><br>
Timeout: <input name="ET" type="number" min="1" max="65000" required> ms<br>
Force max brightness: <input type="checkbox" name="FB"><br>
Disable realtime gamma correction: <input type="checkbox" name="RG"><br>

File diff suppressed because it is too large Load Diff

View File

@ -90,7 +90,7 @@
#endif
//version code in format yymmddb (b = daily build)
#define VERSION 2002021
#define VERSION 2002181
char versionString[] = "0.9.1";