This commit is contained in:
cschwinne 2020-02-09 10:35:37 +01:00
commit c055477d3b
6 changed files with 241 additions and 75 deletions

View File

@ -51,7 +51,7 @@ lib_deps_external =
https://github.com/crankyoldgit/IRremoteESP8266.git https://github.com/crankyoldgit/IRremoteESP8266.git
#Time@1.5 #Time@1.5
#Timezone@1.2.1 #Timezone@1.2.1
#For use SSD1306 0.91" OLED display uncomment following #For use SSD1306 OLED display uncomment following
#U8g2@~2.27.2 #U8g2@~2.27.2
#For Dallas sensor uncomment following 2 lines #For Dallas sensor uncomment following 2 lines
#DallasTemperature@~3.8.0 #DallasTemperature@~3.8.0

View File

@ -1,6 +1,7 @@
![WLED logo](https://raw.githubusercontent.com/Aircoookie/WLED/master/wled_logo.png) ![WLED logo](https://raw.githubusercontent.com/Aircoookie/WLED/master/wled_logo.png)
[![](https://img.shields.io/github/release/Aircoookie/WLED.svg?style=flat-square)](https://github.com/Aircoookie/WLED/releases) [![](https://img.shields.io/github/release/Aircoookie/WLED.svg?style=flat-square)](https://github.com/Aircoookie/WLED/releases)
[![](https://img.shields.io/discourse/topics?colorB=blue&label=forum&server=https%3A%2F%2Fwled.discourse.group%2F&style=flat-square)](https://wled.discourse.group)
[![](https://img.shields.io/discord/473448917040758787.svg?colorB=blue&label=discord&style=flat-square)](https://discord.gg/KuqP7NE) [![](https://img.shields.io/discord/473448917040758787.svg?colorB=blue&label=discord&style=flat-square)](https://discord.gg/KuqP7NE)
[![](https://img.shields.io/badge/quick_start-wiki-blue.svg?style=flat-square)](https://github.com/Aircoookie/WLED/wiki) [![](https://img.shields.io/badge/quick_start-wiki-blue.svg?style=flat-square)](https://github.com/Aircoookie/WLED/wiki)
[![](https://img.shields.io/badge/app-wled-blue.svg?style=flat-square)](https://github.com/Aircoookie/WLED-App) [![](https://img.shields.io/badge/app-wled-blue.svg?style=flat-square)](https://github.com/Aircoookie/WLED-App)
@ -57,7 +58,8 @@ Credits [here](https://github.com/Aircoookie/WLED/wiki/Contributors-&-About)!
Uses Linearicons by Perxis! Uses Linearicons by Perxis!
Join the Discord [server](https://discord.gg/KuqP7NE) to discuss everything about WLED! Join the Discord [server](https://discord.gg/KuqP7NE) to discuss everything about WLED!
You can also send me mails to [dev.aircoookie@gmail.com](mailto:dev.aircoookie@gmail.com). Check out the WLED [Discourse forum](https://wled.discourse.group)!
You can also send me mails to [dev.aircoookie@gmail.com](mailto:dev.aircoookie@gmail.com), but please only do so if you want to talk to me privately.
If WLED really brightens up your every day, you can [![](https://img.shields.io/badge/send%20me%20a%20small%20gift-paypal-blue.svg?style=flat-square)](https://paypal.me/aircoookie) If WLED really brightens up your every day, you can [![](https://img.shields.io/badge/send%20me%20a%20small%20gift-paypal-blue.svg?style=flat-square)](https://paypal.me/aircoookie)
*Disclaimer:* *Disclaimer:*

View File

@ -5,7 +5,7 @@
#define U8X8_PIN_SCL 5 #define U8X8_PIN_SCL 5
#define U8X8_PIN_SDA 4 #define U8X8_PIN_SDA 4
// Dallas sensor // Dallas sensor
OneWire oneWire(12); OneWire oneWire(13);
DallasTemperature sensor(&oneWire); DallasTemperature sensor(&oneWire);
long temptimer = millis(); long temptimer = millis();
long lastMeasure = 0; long lastMeasure = 0;
@ -16,9 +16,9 @@ long lastMeasure = 0;
// https://github.com/olikraus/u8g2/wiki/u8x8setupcpp // https://github.com/olikraus/u8g2/wiki/u8x8setupcpp
// or check the gallery: // or check the gallery:
// https://github.com/olikraus/u8g2/wiki/gallery // https://github.com/olikraus/u8g2/wiki/gallery
// --> First choise of cheap I2C OLED 128X32 // --> First choise of cheap I2C OLED 128X32 0.91"
U8X8_SSD1306_128X32_UNIVISION_HW_I2C u8x8(U8X8_PIN_NONE, U8X8_PIN_SCL, U8X8_PIN_SDA); // Pins are Reset, SCL, SDA U8X8_SSD1306_128X32_UNIVISION_HW_I2C u8x8(U8X8_PIN_NONE, U8X8_PIN_SCL, U8X8_PIN_SDA); // Pins are Reset, SCL, SDA
// --> Second choise of cheap I2C OLED 128X64 // --> Second choise of cheap I2C OLED 128X64 0.96" or 1.3"
//U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(U8X8_PIN_NONE, U8X8_PIN_SCL, U8X8_PIN_SDA); // Pins are Reset, SCL, SDA //U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(U8X8_PIN_NONE, U8X8_PIN_SCL, U8X8_PIN_SDA); // Pins are Reset, SCL, SDA
// gets called once at boot. Do all initialization that doesn't depend on // gets called once at boot. Do all initialization that doesn't depend on
// network here // network here

View File

@ -346,7 +346,7 @@ uint16_t WS2812FX::mode_dual_scan(void) {
* Cycles all LEDs at once through a rainbow. * Cycles all LEDs at once through a rainbow.
*/ */
uint16_t WS2812FX::mode_rainbow(void) { uint16_t WS2812FX::mode_rainbow(void) {
uint16_t counter = (now * ((SEGMENT.speed >> 3) +2)) & 0xFFFF; uint16_t counter = (now * ((SEGMENT.speed >> 2) +2)) & 0xFFFF;
counter = counter >> 8; counter = counter >> 8;
if (SEGMENT.intensity < 128){ if (SEGMENT.intensity < 128){
@ -363,7 +363,7 @@ uint16_t WS2812FX::mode_rainbow(void) {
* Cycles a rainbow over the entire string of LEDs. * Cycles a rainbow over the entire string of LEDs.
*/ */
uint16_t WS2812FX::mode_rainbow_cycle(void) { uint16_t WS2812FX::mode_rainbow_cycle(void) {
uint16_t counter = (now * ((SEGMENT.speed >> 3) +2)) & 0xFFFF; uint16_t counter = (now * ((SEGMENT.speed >> 2) +2)) & 0xFFFF;
counter = counter >> 8; counter = counter >> 8;
for(uint16_t i = 0; i < SEGLEN; i++) { for(uint16_t i = 0; i < SEGLEN; i++) {
@ -691,18 +691,58 @@ uint16_t WS2812FX::mode_android(void) {
* color2 and color3 = colors of two adjacent leds * color2 and color3 = colors of two adjacent leds
*/ */
uint16_t WS2812FX::chase(uint32_t color1, uint32_t color2, uint32_t color3, bool dopalette) { uint16_t WS2812FX::chase(uint32_t color1, uint32_t color2, uint32_t color3, bool dopalette) {
uint16_t counter = now * (SEGMENT.speed >> 3) + 1; uint16_t counter = now * ((SEGMENT.speed >> 2) + 1);
uint16_t a = counter * SEGLEN >> 16; uint16_t a = counter * SEGLEN >> 16;
SEGENV.step = a;
uint8_t size = 1 + (SEGMENT.intensity * SEGLEN >> 10);
if (SEGENV.call == 0) {SEGENV.aux0 = 0; SEGENV.aux1 = a;}
// Use intensity setting to vary chase up to 1/2 string length // Use intensity setting to vary chase up to 1/2 string length
uint16_t b = (a + 1 + (SEGMENT.intensity * SEGLEN >> 10)) % SEGLEN; uint16_t b = (a + size) % SEGLEN;
uint16_t c = (b + 1 + (SEGMENT.intensity * SEGLEN >> 10)) % SEGLEN; uint16_t c = (b + size) % SEGLEN;
if (dopalette) color1 = color_from_palette(a, true, PALETTE_SOLID_WRAP, 1); if (dopalette) color1 = color_from_palette(a, true, PALETTE_SOLID_WRAP, 1);
setPixelColor(a, color1); setPixelColor(a, color1);
if (SEGENV.aux0 == 0) { // catch the first pixels after color change from "chase random" (because they have the "old" color)
for (uint16_t i = 0; i < a; i++) {
uint32_t color = getPixelColor(0);
setPixelColor(i, color1);
}
SEGENV.aux0 = 1;
}
setPixelColor(b, color2); setPixelColor(b, color2);
setPixelColor(c, color3); setPixelColor(c, color3);
if (a != SEGENV.aux1) { // when speed is too fast, this catches the gaps
if (a > SEGENV.aux1) {
for (uint16_t i = SEGENV.aux1; i <= a; i++) { // sometimes the step-length varies from one to the next call - therefor "<= a" and not "< a"
setPixelColor(i, color1);
uint16_t b1 = (i + size) % SEGLEN;
uint16_t c1 = (b1 + size) % SEGLEN;
setPixelColor(b1, color2);
setPixelColor(c1, color3);
}
} else {
for (uint16_t i = SEGENV.aux1; i <= SEGLEN; i++) { // from last position to the end
setPixelColor(i, color1);
uint16_t b1 = (i + size) % SEGLEN;
uint16_t c1 = (b1 + size) % SEGLEN;
setPixelColor(b1, color2);
setPixelColor(c1, color3);
}
for (uint16_t i = 0; i < a; i++) { // from 0 to the actual position
setPixelColor(i, color1);
uint16_t b1 = (i + size) % SEGLEN;
uint16_t c1 = (b1 + size) % SEGLEN;
setPixelColor(b1, color2);
setPixelColor(c1, color3);
}
SEGENV.step = 0;
SEGENV.aux0 = 0;
}
}
SEGENV.aux1 = ++a;
return FRAMETIME; return FRAMETIME;
} }
@ -719,10 +759,12 @@ uint16_t WS2812FX::mode_chase_color(void) {
* Primary running followed by random color. * Primary running followed by random color.
*/ */
uint16_t WS2812FX::mode_chase_random(void) { uint16_t WS2812FX::mode_chase_random(void) {
if (!SEGENV.allocateData(2)) return mode_static(); //allocation failed
if (SEGENV.call == 0) SEGENV.data[0] = 0;
if (SEGENV.step == 0) { if (SEGENV.step == 0) {
SEGENV.aux0 = get_random_wheel_index(SEGENV.aux0); SEGENV.data[0] = get_random_wheel_index(SEGENV.data[0]);
} }
return chase(color_wheel(SEGENV.aux0), SEGCOLOR(0), SEGCOLOR(0), false); return chase(color_wheel(SEGENV.data[0]), SEGCOLOR(0), SEGCOLOR(0), false);
} }
@ -1039,6 +1081,10 @@ uint16_t WS2812FX::mode_comet(void) {
for (uint16_t i = SEGENV.aux0; i < index ; i++) { for (uint16_t i = SEGENV.aux0; i < index ; i++) {
setPixelColor( i, color_from_palette(i, true, PALETTE_SOLID_WRAP, 0)); setPixelColor( i, color_from_palette(i, true, PALETTE_SOLID_WRAP, 0));
} }
} else if (index < SEGENV.aux0 && index < 10) {
for (uint16_t i = 0; i < index ; i++) {
setPixelColor( i, color_from_palette(i, true, PALETTE_SOLID_WRAP, 0));
}
} }
SEGENV.aux0 = index++; SEGENV.aux0 = index++;
@ -1184,20 +1230,23 @@ uint16_t WS2812FX::police_base(uint32_t color1, uint32_t color2)
if (idexR >= SEGLEN) idexR = 0; if (idexR >= SEGLEN) idexR = 0;
uint16_t topindex = SEGLEN >> 1; uint16_t topindex = SEGLEN >> 1;
uint16_t idexB = idexR + topindex; uint16_t idexB = (idexR > topindex) ? idexR - topindex : idexR + topindex;
if (SEGENV.call == 0) SEGENV.aux0 = idexR; if (SEGENV.call == 0) SEGENV.aux0 = idexR;
if (idexR > topindex) idexB -= SEGLEN;
if (idexB >= SEGLEN) idexB = 0; //otherwise overflow on odd number of LEDs if (idexB >= SEGLEN) idexB = 0; //otherwise overflow on odd number of LEDs
uint8_t gap = (SEGENV.aux0 < idexR)? idexR - SEGENV.aux0:SEGLEN - SEGENV.aux0 + idexR; if (SEGENV.aux0 == idexR) {
for (uint8_t i = 0; i < gap ; i++) { setPixelColor(idexR, color1);
if ((idexR - i) < 0) idexR = SEGLEN-1 + i; setPixelColor(idexB, color2);
if ((idexB - i) < 0) idexB = SEGLEN-1 + i; } else {
setPixelColor(idexR-i, color1); uint8_t gap = (SEGENV.aux0 < idexR)? idexR - SEGENV.aux0:SEGLEN - SEGENV.aux0 + idexR;
setPixelColor(idexB-i, color2); 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; return FRAMETIME;
} }
@ -3009,25 +3058,38 @@ uint16_t WS2812FX::mode_plasma(void) {
*/ */
uint16_t WS2812FX::mode_percent(void) { uint16_t WS2812FX::mode_percent(void) {
uint8_t percent = max(0, min(100, SEGMENT.intensity)); uint8_t percent = max(0, min(200, SEGMENT.intensity));
uint16_t active_leds = SEGLEN * percent / 100.0; uint16_t active_leds = (percent < 100) ? SEGLEN * percent / 100.0
: SEGLEN * (200 - percent) / 100.0;
if (SEGENV.call == 0) SEGENV.step = 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)) & 0xFF ;
for (uint16_t i = 0; i < SEGLEN; i++) { if (percent < 100) {
if (i < SEGENV.step) { for (uint16_t i = 0; i < SEGLEN; i++) {
setPixelColor(i, color_from_palette(i, true, PALETTE_SOLID_WRAP, 0)); if (i < SEGENV.step) {
} setPixelColor(i, color_from_palette(i, true, PALETTE_SOLID_WRAP, 0));
else { }
setPixelColor(i, SEGCOLOR(1)); else {
} setPixelColor(i, SEGCOLOR(1));
} }
if(active_leds > SEGENV.step) { }
} else {
for (uint16_t i = 0; i < SEGLEN; i++) {
if (i < (SEGLEN - SEGENV.step)) {
setPixelColor(i, SEGCOLOR(1));
}
else {
setPixelColor(i, color_from_palette(i, true, PALETTE_SOLID_WRAP, 0));
}
}
}
if(active_leds > SEGENV.step) { // smooth transition to the target value
SEGENV.step += size; SEGENV.step += size;
if (SEGENV.step > active_leds) SEGENV.step = active_leds; if (SEGENV.step > active_leds) SEGENV.step = active_leds;
} else if (active_leds < SEGENV.step) { } else if (active_leds < SEGENV.step) {
SEGENV.step -= size; if (SEGENV.step > size) SEGENV.step -= size; else SEGENV.step = 0;
if (SEGENV.step < active_leds) SEGENV.step = active_leds; if (SEGENV.step < active_leds) SEGENV.step = active_leds;
} }

View File

@ -46,6 +46,12 @@ p {
color: #ddd; color: #ddd;
} }
td {
text-align: center;
text-transform: uppercase;
font-size: 14px;
}
button { button {
outline: none; outline: none;
cursor: pointer; cursor: pointer;
@ -86,6 +92,15 @@ button {
margin: -2px 0 4px 0; margin: -2px 0 4px 0;
} }
table {
table-layout: fixed;
width: 76%;
}
td {
text-align: center;
}
.slider-icon .slider-icon
{ {
transform: translateY(2px); transform: translateY(2px);
@ -370,7 +385,7 @@ input[type=range]::-ms-thumb {
background-color: #333; background-color: #333;
color: white; color: white;
border: 0px solid white; border: 0px solid white;
border-radius: 5px; border-radius: 25px;
filter: drop-shadow(0px 0px 2px #000); filter: drop-shadow(0px 0px 2px #000);
transition-duration: 0.5s; transition-duration: 0.5s;
-webkit-backface-visibility: hidden; -webkit-backface-visibility: hidden;
@ -387,13 +402,32 @@ input[type=range]::-ms-thumb {
vertical-align: middle; vertical-align: middle;
} }
.qcs-w {
margin-top: 10px;
}
.qcs {
padding: 14px;
margin: 2px;
border-radius: 14px;
display: inline-block;
}
.qcsb {
padding: 13px;
border: 1px solid white;
}
.cl {
width: 42px;
}
select { select {
-webkit-appearance: none; -webkit-appearance: none;
-moz-appearance: none; -moz-appearance: none;
appearance: none; appearance: none;
background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='white'><polygon points='0,0 100,0 50,50'/></svg>") no-repeat; background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='white'><polygon points='0,0 100,0 50,50'/></svg>") no-repeat;
background-size: 12px; background-size: 12px;
background-position: 210px 16px; background-position: 206px 16px;
padding-left: 12px !important;
background-repeat: no-repeat; background-repeat: no-repeat;
outline: none; outline: none;
} }
@ -432,21 +466,21 @@ input[type=number]::-webkit-outer-spin-button {
-webkit-appearance: none; -webkit-appearance: none;
} }
.botpad { .segn {
margin-bottom: 16px !important; margin: 3px 0 6px 0 !important;
} }
.ic { .ic {
padding: 6px 0 0 0; padding: 6px 0 0 0;
} }
.xs { .xxs {
width: 60px; width: 40px;
margin: 6px;
} }
.xxs { .rect {
width: 42px; border-radius: 5px;
margin: 8px;
} }
.psts { .psts {
@ -470,11 +504,19 @@ input[type=number]::-webkit-outer-spin-button {
} }
.cnf { .cnf {
position: absolute; position: absolute;
top: 75px; top: 66px;
right: 60px; right: 28px;
color: #fff; color: #fff;
cursor: pointer; cursor: pointer;
background: #333;
padding: 43px 6px;
border-radius: 5px;
}
.half {
padding: 6px 6px;
top: 64px;
} }
.del { .del {
@ -572,8 +614,12 @@ input[type=number]::-webkit-outer-spin-button {
.h { .h {
font-size: 13px; font-size: 13px;
text-align: center;
color: #bbb; color: #bbb;
text-align: left; }
.bp {
margin-bottom: 5px;
} }
.seg { .seg {
@ -652,6 +698,19 @@ input[type=number]::-webkit-outer-spin-button {
<div class="sliderdisplay"></div> <div class="sliderdisplay"></div>
</div> </div>
</div> </div>
<div class="qcs-w">
<div class="qcs" onclick="pC('#ff0000');" style="background-color:#ff0000;"></div>
<div class="qcs" onclick="pC('#ffa000');" style="background-color:#ffa000;"></div>
<div class="qcs" onclick="pC('#ffc800');" style="background-color:#ffc800;"></div>
<div class="qcs" onclick="pC('#fff0a0');" style="background-color:#fff0a0;"></div>
<div class="qcs" onclick="pC('#ffffff');" style="background-color:#ffffff;"></div>
<div class="qcs qcsb" onclick="pC('#000000');" style="background-color:#000000;"></div><br>
<div class="qcs" onclick="pC('#ff00ff');" style="background-color:#ff00ff;"></div>
<div class="qcs" onclick="pC('#0000ff');" style="background-color:#0000ff;"></div>
<div class="qcs" onclick="pC('#00ffc8');" style="background-color:#00ffc8;"></div>
<div class="qcs" onclick="pC('#08ff00');" style="background-color:#08ff00;"></div>
<div class="qcs" onclick="pC('rnd');" style="background-color:#333; padding: 4px 8px; transform: translateY(-10px);">R</div>
</div>
<div id="csl"> <div id="csl">
<button class="xxs cl btn" onclick="selectSlot(0);">1</button> <button class="xxs cl btn" onclick="selectSlot(0);">1</button>
<button class="xxs cl btn" onclick="selectSlot(1);">2</button> <button class="xxs cl btn" onclick="selectSlot(1);">2</button>
@ -734,8 +793,8 @@ input[type=number]::-webkit-outer-spin-button {
</label><br> </label><br>
First preset: <input id="cycs" class="noslide" type="number" min="1" max="14" value="1"><br> First preset: <input id="cycs" class="noslide" type="number" min="1" max="14" value="1"><br>
Last preset: <input id="cyce" class="noslide" type="number" min="2" max="15" value="3"><br> Last preset: <input id="cyce" class="noslide" type="number" min="2" max="15" value="3"><br>
Time per preset: <input id="cyct" class="noslide" type="number" min="0.2" max="65.5" value="1.2">s<br> Time per preset: <input id="cyct" class="noslide" type="number" min="0.2" max="65.5" step="0.1" value="1.2">s<br>
Transition: <input id="cyctt" class="noslide" type="number" min="0" max="65.5" value="0.7">s Transition: <input id="cyctt" class="noslide" type="number" min="0" max="65.5" step="0.1" value="0.7">s
</div> </div>
</div> </div>
@ -864,9 +923,27 @@ function populateSegments(s)
</label> </label>
<i class="icons slider-icon flr ${expanded[i] ? "exp":""}" id="sege${i}" onclick="expand(${i})">&#xe395;</i> <i class="icons slider-icon flr ${expanded[i] ? "exp":""}" id="sege${i}" onclick="expand(${i})">&#xe395;</i>
<div class="segin ${expanded[i] ? "expanded":""}" id="seg${i}"> <div class="segin ${expanded[i] ? "expanded":""}" id="seg${i}">
Start LED: <input class="starts noslide" id="seg${i}s" type="number" min="0" max="${ledCount-1}" value="${inst.start}" oninput="updateLen(this)"><br> <table>
Stop LED: <input class="stops noslide botpad" id="seg${i}e" type="number" min="0" max="${ledCount}" value="${inst.stop}" oninput="updateLen(this)"> <tr>
<span class="h">(${inst.stop - inst.start} LED${inst.stop - inst.start > 1 ? "s":""})</span><br> <td>Start LED</td>
<td>Stop LED</td>
</tr>
<tr>
<td><input class="noslide segn" id="seg${i}s" type="number" min="0" max="${ledCount-1}" value="${inst.start}" oninput="updateLen(${i})"></td>
<td><input class="noslide segn" id="seg${i}e" type="number" min="0" max="${ledCount}" value="${inst.stop}" oninput="updateLen(${i})"></td>
</tr>
</table>
<table>
<tr>
<td>Grouping</td>
<td>Spacing</td>
</tr>
<tr>
<td><input class="noslide segn" id="seg${i}grp" type="number" min="1" max="255" value="${inst.grp}" oninput="updateLen(${i})"></td>
<td><input class="noslide segn" id="seg${i}spc" type="number" min="0" max="255" value="${inst.spc}" oninput="updateLen(${i})"></td>
</tr>
</table>
<div class="h bp" id="seg${i}len">${inst.stop - inst.start} LED${inst.stop - inst.start > 1 ? "s":""} (${Math.ceil((inst.stop - inst.start)/(inst.grp + inst.spc))} virtual)</div>
<i class="icons slider-icon cnf" id="segc${i}" onclick="setSeg(${i})">&#xe390;</i> <i class="icons slider-icon cnf" id="segc${i}" onclick="setSeg(${i})">&#xe390;</i>
<i class="icons slider-icon del" id="segd${i}" onclick="delSeg(${i})">&#xe037;</i> <i class="icons slider-icon del" id="segd${i}" onclick="delSeg(${i})">&#xe037;</i>
<label class="check revchkl"> <label class="check revchkl">
@ -896,18 +973,28 @@ function updateTrail(e)
e.parentNode.getElementsByClassName('sliderdisplay')[0].style.background = val; e.parentNode.getElementsByClassName('sliderdisplay')[0].style.background = val;
} }
function updateLen(e) function updateLen(s)
{ {
var len = e.parentNode.getElementsByClassName('stops')[0].value; var start = parseInt(d.getElementById(`seg${s}s`).value);
len -= e.parentNode.getElementsByClassName('starts')[0].value; var stop = parseInt(d.getElementById(`seg${s}e`).value);
var len = stop - start;
var out = "(delete)"
if (len > 1) { if (len > 1) {
len = `(${len} LEDs)`; out = `${len} LEDs`;
} else if (len == 1) { } else if (len == 1) {
len = "(1 LED)" out = "1 LED"
} else {
len = "(delete)";
} }
e.parentNode.getElementsByClassName('h')[0].innerHTML = len;
if (d.getElementById(`seg${s}grp`) != null)
{
var grp = parseInt(d.getElementById(`seg${s}grp`).value);
var spc = parseInt(d.getElementById(`seg${s}spc`).value);
if (grp == 0) grp = 1;
var virt = Math.ceil(len/(grp + spc));
if (!isNaN(virt) && (grp > 1 || spc > 0)) out += ` (${virt} virtual)`;
}
d.getElementById(`seg${s}len`).innerHTML = out;
} }
function updateUI() function updateUI()
@ -948,7 +1035,7 @@ function requestJson(command, verbose = true) {
e1 = d.getElementById('fxlist'); e1 = d.getElementById('fxlist');
e2 = d.getElementById('selectPalette'); e2 = d.getElementById('selectPalette');
url = command ? '/json/state':'/json'; url = command ? 'http://10.10.1.26/json/state':'http://10.10.1.26/json';
type = command ? 'post':'get'; type = command ? 'post':'get';
if (command) if (command)
@ -1105,17 +1192,25 @@ function makeSeg() {
Segment ${lowestUnused} (new) Segment ${lowestUnused} (new)
</label> </label>
<div class="segin expanded"> <div class="segin expanded">
Start LED: <input class="starts noslide" id="seg${lowestUnused}s" type="number" min="0" max="${ledCount-1}" value="${ns}" oninput="updateLen(this)"><br> <table>
Stop LED: <input class="stops noslide" id="seg${lowestUnused}e" type="number" min="0" max="${ledCount}" value="${ledCount}" oninput="updateLen(this)"> <tr>
<span class="h">(${ledCount - ns} LEDs)</span><br> <td>Start LED</td>
<i class="icons slider-icon cnf" id="segc${lowestUnused}" onclick="setSeg(${lowestUnused}); resetUtil();">&#xe390;</i> <td>Stop LED</td>
</tr>
<tr>
<td><input class="noslide segn" id="seg${lowestUnused}s" type="number" min="0" max="${ledCount-1}" value="${ns}" oninput="updateLen(${lowestUnused})"></td>
<td><input class="noslide segn" id="seg${lowestUnused}e" type="number" min="0" max="${ledCount}" value="${ledCount}" oninput="updateLen(${lowestUnused})"></td>
</tr>
</table>
<div class="h" id="seg${lowestUnused}len">${ledCount - ns} LEDs</div>
<i class="icons slider-icon cnf half" id="segc${lowestUnused}" onclick="setSeg(${lowestUnused}); resetUtil();">&#xe390;</i>
</div> </div>
</div>`; </div>`;
d.getElementById('segutil').innerHTML = cn; d.getElementById('segutil').innerHTML = cn;
} }
function resetUtil() { function resetUtil() {
var cn = `<button class="btn btn-i" onclick="makeSeg()"><i class="icons btn-icon">&#xe18a;</i>Add segment</button><br>`; var cn = `<button class="btn btn-i rect" onclick="makeSeg()"><i class="icons btn-icon">&#xe18a;</i>Add segment</button><br>`;
d.getElementById('segutil').innerHTML = cn; d.getElementById('segutil').innerHTML = cn;
} }
@ -1130,6 +1225,13 @@ function setSeg(s){
var stop = parseInt(d.getElementById(`seg${s}e`).value); var stop = parseInt(d.getElementById(`seg${s}e`).value);
if (stop <= start) {delSeg(s); return;}; if (stop <= start) {delSeg(s); return;};
var obj = {"seg": {"id": s, "start": start, "stop": stop}}; var obj = {"seg": {"id": s, "start": start, "stop": stop}};
if (d.getElementById(`seg${s}grp`))
{
var grp = parseInt(d.getElementById(`seg${s}grp`).value);
var spc = parseInt(d.getElementById(`seg${s}spc`).value);
obj.seg.grp = grp;
obj.seg.spc = spc;
}
requestJson(obj); requestJson(obj);
} }
@ -1225,9 +1327,9 @@ function selectSlot(b) {
cd[i].style.margin="5px"; cd[i].style.margin="5px";
cd[i].style.width="42px"; cd[i].style.width="42px";
} }
cd[csel].style.border="6px solid white"; cd[csel].style.border="5px solid white";
cd[csel].style.margin="2px"; cd[csel].style.margin="2px";
cd[csel].style.width="54px"; cd[csel].style.width="50px";
if (cpick.color.rgbString !== cd[csel].style.backgroundColor) { if (cpick.color.rgbString !== cd[csel].style.backgroundColor) {
cpick.color.set(cd[csel].style.backgroundColor); cpick.color.set(cd[csel].style.backgroundColor);
} }

View File

@ -234,13 +234,13 @@ Group Topic: <input name="MG" maxlength="32"><br>
<i>Reboot required to apply changes. </i><a href="https://github.com/Aircoookie/WLED/wiki/MQTT" target="_blank">MQTT info</a> <i>Reboot required to apply changes. </i><a href="https://github.com/Aircoookie/WLED/wiki/MQTT" target="_blank">MQTT info</a>
<h3>Philips Hue</h3> <h3>Philips Hue</h3>
<i>You can find the bridge IP and the light number in the 'About' section of the hue app.</i><br> <i>You can find the bridge IP and the light number in the 'About' section of the hue app.</i><br>
Poll Hue light <input name="HL" type="number" min="1" max="99" required> every <input name="HI" type="number" min="100" max="65000" required> ms: <input type="checkbox" name="HP"><br> Poll Hue light <input name="HL" type="number" min="1" max="99" > every <input name="HI" type="number" min="100" max="65000"> ms: <input type="checkbox" name="HP"><br>
Then, receive <input type="checkbox" name="HO"> On/Off, <input type="checkbox" name="HB"> Brightness, and <input type="checkbox" name="HC"> Color<br> Then, receive <input type="checkbox" name="HO"> On/Off, <input type="checkbox" name="HB"> Brightness, and <input type="checkbox" name="HC"> Color<br>
Hue Bridge IP:<br> Hue Bridge IP:<br>
<input name="H0" type="number" min="0" max="255" required> . <input name="H0" type="number" min="0" max="255" > .
<input name="H1" type="number" min="0" max="255" required> . <input name="H1" type="number" min="0" max="255" > .
<input name="H2" type="number" min="0" max="255" required> . <input name="H2" type="number" min="0" max="255" > .
<input name="H3" type="number" min="0" max="255" required><br> <input name="H3" type="number" min="0" max="255" ><br>
<b>Press the pushlink button on the bridge, after that save this page!</b><br> <b>Press the pushlink button on the bridge, after that save this page!</b><br>
(when first connecting)<br> (when first connecting)<br>
Hue status: <span class="hms"> Internal ESP Error! </span><hr> Hue status: <span class="hms"> Internal ESP Error! </span><hr>