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,6 +1230,17 @@ 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
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);
@ -1245,6 +1255,7 @@ uint16_t WS2812FX::police_base(uint32_t color1, uint32_t color2)
}
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 + 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 + 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,7 +2156,24 @@ uint16_t WS2812FX::mode_ripple()
Ripple* ripples = reinterpret_cast<Ripple*>(SEGENV.data);
// 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++) {
@ -3093,3 +3132,33 @@ 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;

View File

@ -103,7 +103,7 @@ td {
.slider-icon
{
transform: translateY(2px);
transform: translateY(3px);
color: #ddd;
}
@ -141,7 +141,7 @@ td {
.tab {
background-color: #222;
color: #ddd;
filter: drop-shadow(0px 0px 2px #000);
//filter: drop-shadow(0px 0px 2px #000);
}
.bot {
@ -658,6 +658,12 @@ input[type=number]::-webkit-outer-spin-button {
float: none;
}
}
@media all and (max-width: 1250px) {
#buttonPcm {
display: none;
}
}
</style>
</head>
<body onload="onLoad()">
@ -673,6 +679,7 @@ input[type=number]::-webkit-outer-spin-button {
<button id="buttonSync" onclick="toggleSync()"><i class="icons">&#xe116;</i><p class="tab-label">Sync</p></button>
<button id="buttonSr" onclick="toggleLiveview()"><i class="icons">&#xe410;</i><p class="tab-label">Preview</p></button>
<button onclick="window.location.href = '/settings';"><i class="icons">&#xe0a2;</i><p class="tab-label">Config</p></button>
<button id="buttonPcm" onclick="togglePcMode()"><i class="icons">&#xe23d;</i><p class="tab-label">PC Mode</p></button>
</div>
<div id="briwrap">
<p class="hd">Brightness</p>
@ -833,6 +840,7 @@ var savedPresets = 0;
var currentPreset = -1;
var lastUpdate = 0;
var segCount = 0, ledCount = 0, lowestUnused = 0, maxSeg = 0;
var pcMode = false;
var d = document;
const ranges = RangeTouch.setup('input[type="range"]', {});
@ -872,10 +880,12 @@ function updateTablinks(tabI)
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
if (pcMode) return;
tablinks[tabI].className += " active";
}
function openTab(tabI) {
if (pcMode) return;
var i, tabcontent, tablinks;
iSlide = tabI;
_C.classList.toggle('smooth', false);
@ -1035,7 +1045,7 @@ function requestJson(command, verbose = true) {
e1 = d.getElementById('fxlist');
e2 = d.getElementById('selectPalette');
url = command ? 'http://10.10.1.26/json/state':'http://10.10.1.26/json';
url = command ? '/json/state':'/json';
type = command ? 'post':'get';
if (command)
@ -1337,12 +1347,28 @@ function selectSlot(b) {
updateTrail(d.getElementById('sliderW'));
}
var lasth = 0;
function pC(col)
{
if (col == "rnd")
{
col = {h: 0, s: 0, v: 100};
col.s = Math.floor((Math.random() * 50) + 50);
do {
col.h = Math.floor(Math.random() * 360);
} while (Math.abs(col.h - lasth) < 50);
lasth = col.h;
}
cpick.color.set(col);
setColor(false);
}
function setColor(fromPicker) {
var cd = d.getElementById('csl').children;
if (fromPicker && cd[csel].style.backgroundColor == 'rgb(0, 0, 0)') cpick.color.setChannel('hsv', 'v', 100);
cd[csel].style.backgroundColor = cpick.color.rgbString;
whites[csel] = d.getElementById('sliderW').value;
col = cpick.color.rgb;
var col = cpick.color.rgb;
var obj = {"seg": {"col": [[col.r, col.g, col.b, whites[csel]],[],[]]}};
if (csel == 1) {
obj = {"seg": {"col": [[],[col.r, col.g, col.b, whites[csel]],[]]}};
@ -1378,6 +1404,7 @@ let iSlide = 0, x0 = null, y0 = null, scrollS = 0, locked = false, w;
function unify(e) { return e.changedTouches ? e.changedTouches[0] : e }
function lock(e) {
if (pcMode) return;
var l = e.target.classList;
if (l.contains('noslide') || l.contains('iro__wheel__saturation') || l.contains('iro__slider__value') || l.contains('iro__slider')) return;
x0 = unify(e).clientX;
@ -1388,7 +1415,7 @@ function lock(e) {
}
function drag(e) {
if (!locked) return;
if (!locked || pcMode) return;
if (d.getElementsByClassName("tabcontent")[iSlide].scrollTop != scrollS) {
move(e); return;
}
@ -1401,7 +1428,7 @@ function drag(e) {
}
function move(e) {
if(!locked) return;
if(!locked || pcMode) return;
var dx = unify(e).clientX - x0, s = Math.sign(dx),
f = +(s*dx/w).toFixed(2);
@ -1421,6 +1448,23 @@ function size() {
w = window.innerWidth;
_C.style.setProperty('--tp', d.getElementById('top').clientHeight + "px");
_C.style.setProperty('--bt', d.getElementById('bot').clientHeight + "px");
if (w < 1250) togglePcMode();
}
function togglePcMode()
{
if (w < 1250 && !pcMode) return;
openTab(0);
pcMode = !pcMode;
if (w < 1250) pcMode = false;
updateTablinks(0);
d.getElementById('buttonPcm').className = (pcMode) ? "active":"";
if (pcMode)
{
_C.style.width = '100%';
} else {
_C.style.width = '400%';
}
}
size();

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";