Added JSON FX + palette lists

This commit is contained in:
cschwinne 2019-02-10 23:05:06 +01:00
parent 6171883758
commit 6e76fc0aa7
14 changed files with 2130 additions and 2324 deletions

View File

@ -889,6 +889,7 @@ uint16_t WS2812FX::mode_merry_christmas(void) {
return running(RED, GREEN);
}
/*
* Alternating orange/purple pixels running.
*/
@ -910,7 +911,11 @@ uint16_t WS2812FX::mode_running_random(void) {
setPixelColor(SEGMENT.start, color_wheel(SEGMENT_RUNTIME.aux_param));
}
SEGMENT_RUNTIME.counter_mode_step = (SEGMENT_RUNTIME.counter_mode_step == 0) ? 1 : 0;
SEGMENT_RUNTIME.counter_mode_step++;
if (SEGMENT_RUNTIME.counter_mode_step > ((255-SEGMENT.intensity) >> 4))
{
SEGMENT_RUNTIME.counter_mode_step = 0;
}
return SPEED_FORMULA_L;
}
@ -976,7 +981,6 @@ uint16_t WS2812FX::fireworks(uint32_t color) {
}
}
}
return SPEED_FORMULA_L;
}
@ -1464,12 +1468,12 @@ uint16_t WS2812FX::mode_random_chase(void)
setPixelColor(i, getPixelColor(i-1));
}
uint32_t color = getPixelColor(SEGMENT.start + 1);
int r = random8(6) != 0 ? (color >> 16 & 0xFF) : random8();
int g = random8(6) != 0 ? (color >> 8 & 0xFF) : random8();
int b = random8(6) != 0 ? (color & 0xFF) : random8();
uint8_t r = random8(6) != 0 ? (color >> 16 & 0xFF) : random8();
uint8_t g = random8(6) != 0 ? (color >> 8 & 0xFF) : random8();
uint8_t b = random8(6) != 0 ? (color & 0xFF) : random8();
setPixelColor(SEGMENT.start, r, g, b);
return 10 + (uint16_t)(255 - SEGMENT.speed);
return SPEED_FORMULA_L;
}
typedef struct Oscillator {
@ -1731,11 +1735,7 @@ uint16_t WS2812FX::mode_colorwaves(void)
uint8_t bri8 = (uint32_t)(((uint32_t)bri16) * brightdepth) / 65536;
bri8 += (255 - brightdepth);
uint8_t index = hue8;
//index = triwave8( index);
index = scale8( index, 240);
CRGB newcolor = ColorFromPalette(currentPalette, index, bri8);
CRGB newcolor = ColorFromPalette(currentPalette, hue8, bri8);
fastled_col = fastled_from_col(getPixelColor(i));
nblend(fastled_col, newcolor, 128);

View File

@ -494,4 +494,139 @@ class WS2812FX {
segment_runtime _segment_runtimes[MAX_NUM_SEGMENTS]; // SRAM footprint: 17 bytes per element
};
const char JSON_mode_names[] PROGMEM = R"=====({"effects":[
"Solid",
"Blink",
"Breathe",
"Wipe",
"Wipe Random",
"Random Colors",
"Sweep",
"Dynamic",
"Colorloop",
"Rainbow",
"Scan",
"Dual Scan",
"Fade",
"Chase",
"Chase Rainbow",
"Running",
"Saw",
"Twinkle",
"Dissolve",
"Dissolve Rnd",
"Sparkle",
"Dark Sparkle",
"Sparkle+",
"Strobe",
"Strobe Rainbow",
"Mega Strobe",
"Blink Rainbow",
"Android",
"Chase",
"Chase Random",
"Chase Rainbow",
"Chase Flash",
"Chase Flash Rnd",
"Rainbow Runner",
"Colorful",
"Traffic Light",
"Sweep Random",
"Running 2",
"Red & Blue",
"Stream",
"Scanner",
"Lighthouse",
"Fireworks",
"Fireworks Rnd",
"Merry Christmas",
"Fire Flicker",
"Gradient",
"Loading",
"In Out",
"In In",
"Out Out",
"Out In",
"Circus",
"Halloween",
"Tri Chase",
"Tri Wipe",
"Tri Fade",
"Lightning",
"ICU",
"Multi Comet",
"Dual Scanner",
"Stream 2",
"Oscillate",
"Pride 2015",
"Juggle",
"Palette",
"Fire 2012",
"Colorwaves",
"BPM",
"Fill Noise",
"Noise 1",
"Noise 2",
"Noise 3",
"Noise 4",
"Colortwinkle",
"Lake",
"Meteor",
"Smooth Meteor",
"Railway",
"Ripple"
]})=====";
const char JSON_palette_names[] PROGMEM = R"=====({"palettes":[
"Default",
"Random Cycle",
"Primary Color",
"Based on Primary",
"Set Colors",
"Based on Set",
"Party",
"Cloud",
"Lava",
"Ocean",
"Forest",
"Rainbow",
"Rainbow Bands",
"Sunset",
"Rivendell",
"Breeze",
"Red & Blue",
"Yellowout",
"Analogous",
"Splash",
"Pastel",
"Sunset 2",
"Beech",
"Vintage",
"Departure",
"Landscape",
"Beach",
"Sherbet",
"Hult",
"Hult 64",
"Drywet",
"Jul",
"Grintage",
"Rewhi",
"Tertiary",
"Fire",
"Icefire",
"Cyane",
"Light Pink",
"Autumn",
"Magenta",
"Magred",
"Yelmag",
"Yelblu",
"Orange & Teal",
"Tiamat",
"April Night"
]})=====";
#endif

View File

@ -29,8 +29,6 @@
#define LED_SKIP_AMOUNT 1
#define LED_SKIP_AMOUNT 1
void WS2812FX::init(bool supportWhite, uint16_t countPixels, bool skipFirst)
{
if (supportWhite == _rgbwMode && countPixels == _length && _locked != NULL) return;

View File

@ -38,8 +38,10 @@
var w=window.getComputedStyle(d.querySelector("html"));
UCol();
CV(0);
setInterval('GIO()', 5000);
setInterval(GIO, 5000);
GIO();
setTimeout(function(){fillfx(0);}, 500);
setTimeout(function(){fillfx(1);}, 750);
}
function GIO()
{
@ -356,6 +358,29 @@
{
resp+="&PL=0";GIO();
}
function fillfx(fp)
{
e="<option>Error loading list!</option>";
el = fp?Cf.FP:Cf.TX;
fetch(fp?'/json/palettes':'/json/effects')
.then(res => {
if (!res.ok) {
el.innerHTML=e;
}
return res.json();
})
.then(json => {
var x="";
var l=fp?json.palettes:json.effects;
for (i in l) {
x += "<option value=\""+i+"\">"+l[i]+" ("+i+")</option>";
}
el.innerHTML=x;
})
.catch(function () {
el.innerHTML=e;
})
}
</script>
<style>
:root {
@ -597,85 +622,7 @@
<svg id="fmf" onclick="SwFX(1)"><use xlink:href="#lnr-arrow-right-circle"></use></svg>
<svg id="fof" onclick="SwFX(99)"><use xlink:href="#lnr-rocket"></use></svg><br><br>
<select name="TX" onchange="GX()">
<option value="0" selected>Solid (0)</option>
<option value="1">Blink (1)</option>
<option value="2">Breath (2)</option>
<option value="3">Wipe (3)</option>
<option value="4">Wipe Random (4)</option>
<option value="5">Color R (5)</option>
<option value="6">Sweep (6)</option>
<option value="7">Dynamic (7)</option>
<option value="8">Colorloop (8)</option>
<option value="9">Rainbow (9)</option>
<option value="10">Scan (10)</option>
<option value="11">Scan x2 (11)</option>
<option value="12">Fade (12)</option>
<option value="13">Chase (13)</option>
<option value="14">Chase Cl (14)</option>
<option value="15">Running (15)</option>
<option value="16">Twinkle (16)</option>
<option value="17">Twinkle R (17)</option>
<option value="18">Twinkle Fade (18)</option>
<option value="19">Twinkle RF (19)</option>
<option value="20">Sparkle (20)</option>
<option value="21">Sparkle Inv (21)</option>
<option value="22">Sparkle Inv+ (22)</option>
<option value="23">Strobe (23)</option>
<option value="24">Strobe Cl (24)</option>
<option value="25">Strobe + (25)</option>
<option value="26">Blink Cl (26)</option>
<option value="27">Android (27)</option>
<option value="28">Chase (28)</option>
<option value="29">Chase R (29)</option>
<option value="30">Chase Rainbow (30)</option>
<option value="31">Chase Flash (31)</option>
<option value="32">Chase RF (32)</option>
<option value="33">Chase Cl Inv (33)</option>
<option value="34">Colorful (34)</option>
<option value="35">Traffic Light (35)</option>
<option value="36">Sweep R(36)</option>
<option value="37">Running 2 (37)</option>
<option value="38">Red/Blue (38)</option>
<option value="39">Running R (39)</option>
<option value="40">Scanner (40)</option>
<option value="41">Lighthouse (41)</option>
<option value="42">Fireworks (42)</option>
<option value="43">Fireworks R (43)</option>
<option value="44">Christmas (44)</option>
<option value="45">Fire Flicker (45)</option>
<option value="46">Gradient (46)</option>
<option value="47">Loading (47)</option>
<option value="48">Wipe IO (48)</option>
<option value="49">Wipe II (49)</option>
<option value="50">Wipe OO (50)</option>
<option value="51">Wipe OI (51)</option>
<option value="52">Circus (52)</option>
<option value="53">Halloween (53)</option>
<option value="54">Tricolor Chase (54)</option>
<option value="55">Tricolor Wipe (55)</option>
<option value="56">Tricolor Fade (56)</option>
<option value="57">Lighting (57)</option>
<option value="58">ICU (58)</option>
<option value="59">Multi Comet (59)</option>
<option value="60">Scanner x2 (60)</option>
<option value="61">Random Chase (61)</option>
<option value="62">Oscillate (62)</option>
<option value="63">Pride 2015 (63)</option>
<option value="64">Juggle (64)</option>
<option value="65">Palette (65)</option>
<option value="66">Fire 2012 (66)</option>
<option value="67">Colorwaves (67)</option>
<option value="68">BPM (68)</option>
<option value="69">Fill Noise 8 (69)</option>
<option value="70">Noise 16 1 (70)</option>
<option value="71">Noise 16 2 (71)</option>
<option value="72">Noise 16 3 (72)</option>
<option value="73">Noise 16 4 (73)</option>
<option value="74">Colortwinkle (74)</option>
<option value="75">Lake (75)</option>
<option value="76">Meteor (76)</option>
<option value="77">Smooth Meteor (77)</option>
<option value="78">Railway (78)</option>
<option>Loading...</option>
</select><br><br>
Set secondary color to
<button type="button" onclick="CS(0)">White</button>
@ -687,53 +634,7 @@
<div id="fpX">
<br>FastLED Palette<br><br>
<select name="FP" onchange="GP()">
<option value="0" selected>Default</option>
<option value="1">Random Cycle</option>
<option value="2">Primary Color Only</option>
<option value="3">Based on Primary</option>
<option value="4">Set Colors Only</option>
<option value="5">Based on Set Colors</option>
<option value="6">Party</option>
<option value="7">Cloud</option>
<option value="8">Lava</option>
<option value="9">Ocean</option>
<option value="10">Forest</option>
<option value="11">Rainbow</option>
<option value="12">Rainbow Stripe</option>
<option value="13">Sunset</option>
<option value="14">Rivendell</option>
<option value="15">Breeze</option>
<option value="16">Red & Blue</option>
<option value="17">Yellowout</option>
<option value="18">Analogous</option>
<option value="19">Splash</option>
<option value="20">Pastel</option>
<option value="21">Sunset2</option>
<option value="22">Beech</option>
<option value="23">Vintage</option>
<option value="24">Departure</option>
<option value="25">Landscape</option>
<option value="26">Beach</option>
<option value="27">Sherbet</option>
<option value="28">Hult</option>
<option value="29">Hult64</option>
<option value="30">Drywet</option>
<option value="31">Jul</option>
<option value="32">Grintage</option>
<option value="33">Rewhi</option>
<option value="34">Tertiary</option>
<option value="35">Fire</option>
<option value="36">Icefire</option>
<option value="37">Cyane</option>
<option value="38">Light Pink</option>
<option value="39">Autumn</option>
<option value="40">Magenta</option>
<option value="41">Magred</option>
<option value="42">Yelmag</option>
<option value="43">Yelblu</option>
<option value="44">Orange & Teal</option>
<option value="43">Tiamat</option>
<option value="44">April Night</option>
<option>Loading...</option>
</select>
</div>
<div id="slX" class="sl">

View File

@ -29,7 +29,7 @@
100%{background-color:#333}
}
.segment{
display: inline-block;
display: inline-block;
height:145px;
max-width:250px;
}
@ -37,7 +37,7 @@
width: 27px;
height: 27px;
float: left;
border: solid;
border: 2px solid white;
border-radius: 30px;
padding: 10px;
margin: 5px;
@ -49,7 +49,7 @@
margin: 10px;
border-color: white;
color: white;
border: solid;
border: 2px solid white;
text-transform: uppercase;
font-family: helvetica;
font-size: 19px;
@ -60,7 +60,7 @@
.mode li a {
color: white;
text-decoration: none;
text-transform: none;
text-transform: none;
font-family: helvetica;
display:block;
}
@ -216,14 +216,14 @@
width:30%;
float:left;
text-align:center;
border:solid;
border: 2px solid white;
border-color:white;
margin: 1px;
padding-top: 10px;
padding-bottom: 10px;
border-radius: 29px;
list-style:none;
border-radius:30px;
margin: 1px;
padding-top: 10px;
padding-bottom: 10px;
border-radius: 29px;
list-style:none;
border-radius:30px;
}
li {
box-shadow: rgba(255,255,255,0) 0 0 0px;
@ -303,7 +303,7 @@
<div class="cC" onclick="pC('#00ffc8');" style="background-color:#00ffc8;">&nbsp;</div>
<div class="cC" onclick="pC('#08ff00');" style="background-color:#08ff00;">&nbsp;</div>
</div>
<div class="row segment" style="height:245px;">
<div class="row segment" style="height:360px;">
<div style="height: 46px;">
<p style="text-align: right; margin-bottom: 5px;">Edit Presets</p>
<div class="oos" style="float:right;">
@ -328,8 +328,8 @@
<div class="cC" onclick="ps(15);">15</div>
<div class="cC" onclick="ps(16);">16</div>
</div>
<div class="row segment" style="height:50px;padding-top:100px; width:280px;">
<p style="text-align:right;margin-bottom:5px;padding-top:15px;">Cycle Mode</p>
<div class="row segment" style="height:50px; width:280px;">
<p style="text-align:right;margin-bottom:5px;">Cycle Mode</p>
<div class="oos" style="float:right;">
<input class="oos-chk oos-chk-cy" id="myoos-cy" name="oos-cy" onclick="tC();" type="checkbox"> <label class="oos-label" for="myoos-cy"></label>
</div>
@ -350,137 +350,14 @@
<p id="CDurL" style="margin-bottom: -4px;">Color Transition</p><input id="cycts" max="65000" min="0" step="50" type="range" value="500">
</div>
<p>FX Mode</p>
<ul class="mode" style="margin-top:20px;">
<li onclick="X(0)">Solid</li>
<li onclick="X(1)">Blink</li>
<li onclick="X(2)">Breathe</li>
<li onclick="X(3)">Wipe</li>
<li onclick="X(4)">Wipe Random</li>
<li onclick="X(5)">Random Colors</li>
<li onclick="X(6)">Sweep</li>
<li onclick="X(7)">Dynamic</li>
<li onclick="X(8)">Colorloop</li>
<li onclick="X(9)">Rainbow</li>
<li onclick="X(10)">Scan</li>
<li onclick="X(11)">Double Scan</li>
<li onclick="X(12)">Fade</li>
<li onclick="X(13)">Chase</li>
<li onclick="X(14)">Chase Rainbow</li>
<li onclick="X(15)">Running</li>
<li onclick="X(16)">Twinkle</li>
<li onclick="X(17)">Twinkle Random</li>
<li onclick="X(18)">Twinkle Fade</li>
<li onclick="X(19)">Twinkle Random Fade</li>
<li onclick="X(20)">Sparkle</li>
<li onclick="X(21)">Dark Sparkle</li>
<li onclick="X(22)">Dark Sparkle+</li>
<li onclick="X(23)">Strobe</li>
<li onclick="X(24)">Strobe Rainbow</li>
<li onclick="X(25)">Double Strobe</li>
<li onclick="X(26)">Blink Rainbow</li>
<li onclick="X(27)">Android</li>
<li onclick="X(28)">Dark Chase</li>
<li onclick="X(29)">Dark Chase Random</li>
<li onclick="X(30)">Dark Chase Rainbow</li>
<li onclick="X(31)">Chase Flash</li>
<li onclick="X(32)">Dark Chase Random</li>
<li onclick="X(33)">Rainbow Runner</li>
<li onclick="X(34)">Colorful</li>
<li onclick="X(35)">Traffic Light</li>
<li onclick="X(36)">Sweep Random</li>
<li onclick="X(37)">Running 2</li>
<li onclick="X(38)">Red & Blue</li>
<li onclick="X(39)">Running 2 Random</li>
<li onclick="X(40)">Scanner</li>
<li onclick="X(41)">Lighthouse</li>
<li onclick="X(42)">Fireworks</li>
<li onclick="X(43)">Fireworks Random</li>
<li onclick="X(44)">Merry Christmas</li>
<li onclick="X(45)">Fire Flicker</li>
<li onclick="X(46)">Gradient</li>
<li onclick="X(47)">Loading</li>
<li onclick="X(48)">In Out</li>
<li onclick="X(49)">In In</li>
<li onclick="X(50)">Out Out</li>
<li onclick="X(51)">Out In</li>
<li onclick="X(52)">Circus</li>
<li onclick="X(53)">Halloween</li>
<li onclick="X(54)">Tri Chase</li>
<li onclick="X(55)">Tri Wipe</li>
<li onclick="X(56)">Tri Fade</li>
<li onclick="X(57)">Lightning</li>
<li onclick="X(58)">ICU</li>
<li onclick="X(59)">Multi Comet</li>
<li onclick="X(60)">Dual Scanner</li>
<li onclick="X(61)">Random Chase</li>
<li onclick="X(62)">Oscillate</li>
<li onclick="X(63)">Pride 2015</li>
<li onclick="X(64)">Juggle</li>
<li onclick="X(65)">Palette</li>
<li onclick="X(66)">Fire 2012</li>
<li onclick="X(67)">Colorwaves</li>
<li onclick="X(68)">BPM</li>
<li onclick="X(69)">Fill Noise 8</li>
<li onclick="X(70)">Noise 16 1</li>
<li onclick="X(71)">Noise 16 2</li>
<li onclick="X(72)">Noise 16 3</li>
<li onclick="X(73)">Noise 16 4</li>
<li onclick="X(74)">Colortwinkle</li>
<li onclick="X(75)">Lake</li>
<li onclick="X(76)">Meteor</li>
<li onclick="X(77)">Smooth Meteor</li>
<li onclick="X(78)">Railway</li></ul>
<ul class="mode" id="fxl" style="margin-top:20px;">
Loading...
</ul>
<p style="margin-bottom: -4px;">FX Speed</p><input id="sxs" max="255" min="0" type="range" value="128">
<p style="margin-bottom: -4px;">FX Intensity</p><input id="ixs" max="255" min="0" type="range" value="128">
<p>FastLED Palette</p>
<ul class="mode">
<li onclick="P(0)">Default</li>
<li onclick="P(1)">Random Cycle</li>
<li onclick="P(2)">Primary Color Only</li>
<li onclick="P(3)">Based on Primary</li>
<li onclick="P(4)">Set Colors Only</li>
<li onclick="P(5)">Based on Set Colors</li>
<li onclick="P(6)">Party</li>
<li onclick="P(7)">Cloud</li>
<li onclick="P(8)">Lava</li>
<li onclick="P(9)">Ocean</li>
<li onclick="P(10)">Forest</li>
<li onclick="P(11)">Rainbow</li>
<li onclick="P(12)">Rainbow Stripe</li>
<li onclick="P(13)">Sunset</li>
<li onclick="P(14)">Rivendell</li>
<li onclick="P(15)">Breeze</li>
<li onclick="P(16)">Red & Blue</li>
<li onclick="P(17)">Yellowout</li>
<li onclick="P(18)">Analogous</li>
<li onclick="P(19)">Splash</li>
<li onclick="P(20)">Pastel</li>
<li onclick="P(21)">Sunset2</li>
<li onclick="P(22)">Beech</li>
<li onclick="P(23)">Vintage</li>
<li onclick="P(24)">Departure</li>
<li onclick="P(25)">Landscape</li>
<li onclick="P(26)">Beach</li>
<li onclick="P(27)">Sherbet</li>
<li onclick="P(28)">Hult</li>
<li onclick="P(29)">Hult64</li>
<li onclick="P(30)">Drywet</li>
<li onclick="P(31)">Jul</li>
<li onclick="P(32)">Grintage</li>
<li onclick="P(33)">Rewhi</li>
<li onclick="P(34)">Tertiary</li>
<li onclick="P(35)">Fire</li>
<li onclick="P(36)">Icefire</li>
<li onclick="P(37)">Cyane</li>
<li onclick="P(38)">Light Pink</li>
<li onclick="P(39)">Autumn</li>
<li onclick="P(40)">Magenta</li>
<li onclick="P(41)">Magred</li>
<li onclick="P(42)">Yelmag</li>
<li onclick="P(43)">Yelblu</li>
<li onclick="P(44)">Orange & Teal</li>
<li onclick="P(45)">Tiamat</li>
<li onclick="P(46)">April Night</li>
<ul class="mode" id="fpl">
Loading...
</ul>
<iframe id="stf" onload="feedback();" style="display:none;"></iframe>
</main>
@ -502,7 +379,7 @@ function feedback(){
var e = d.body;
e.classList.remove("feedbackanim");
void e.offsetWidth;
if(!fs)e.classList.add("feedbackanim");
e.classList.add("feedbackanim");
fs=false;
}
//Speed slider
@ -585,6 +462,28 @@ if (d.getElementById('myoos-n').checked)
EC('win&SN=0');
}
}
function fillfx(fp){
e="Error loading list!";
el = d.getElementById(fp?'fpl':'fxl');
fetch(fp?'/json/palettes':'http://10.10.1.52/json/effects')
.then(res => {
if (!res.ok) {
el.innerHTML=e;
}
return res.json();
})
.then(json => {
var x="";
var l=fp?json.palettes:json.effects;
for (i in l) {
x += "<li onclick=\""+(fp?"P":"X")+"("+i+")\">"+l[i]+"</li>";
}
el.innerHTML=x;
})
.catch(function () {
el.innerHTML=e;
})
}
function ms2mins(millis) {
var minutes = Math.floor(millis / 60000);
var seconds = ((millis % 60000) / 1000).toFixed(0);
@ -614,6 +513,8 @@ return minutes + ":" + (seconds < 10 ? '0' : '') + seconds;
}
if(recv) EC(curl);
});
setTimeout(function(){fillfx(0);}, 500);
setTimeout(function(){fillfx(1);}, 750);
d.getElementById("cv").style.opacity=0;
}
function GIO()
@ -642,6 +543,7 @@ function GIO()
d.getElementsByClassName("desc")[0].innerHTML = this.responseXML.getElementsByTagName('ds')[0].innerHTML;
recv =1;
uB();
setTimeout(fillfx, 500);
}
}
request.open("GET", "win" +nocache, true);

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -3,19 +3,14 @@
*/
//common CSS of settings pages
const char PAGE_settingsCss[] PROGMEM = R"=====(
body{font-family:var(--cFn),sans-serif;text-align:center;background:var(--cCol);color:var(--tCol);line-height:200%;margin:0;background-attachment:fixed}hr{border-color:var(--dCol);filter:drop-shadow(-5px -5px 5px var(--sCol))}button{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:.3ch solid var(--bCol);display:inline-block;filter:drop-shadow(-5px -5px 5px var(--sCol));font-size:20px;margin:8px;margin-top:12px}.helpB{text-align:left;position:absolute;width:60px}input{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:.5ch solid var(--bCol);filter:drop-shadow(-5px -5px 5px var(--sCol))}input[type=number]{width:4em}select{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:0.5ch solid var(--bCol);filter:drop-shadow( -5px -5px 5px var(--sCol) );}td{padding:2px;}</style>
)=====";
const char PAGE_settingsCss[] PROGMEM = R"=====(body{font-family:var(--cFn),sans-serif;text-align:center;background:var(--cCol);color:var(--tCol);line-height:200%;margin:0;background-attachment:fixed}hr{border-color:var(--dCol);filter:drop-shadow(-5px -5px 5px var(--sCol))}button{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:.3ch solid var(--bCol);display:inline-block;filter:drop-shadow(-5px -5px 5px var(--sCol));font-size:20px;margin:8px;margin-top:12px}.helpB{text-align:left;position:absolute;width:60px}input{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:.5ch solid var(--bCol);filter:drop-shadow(-5px -5px 5px var(--sCol))}input[type=number]{width:4em}select{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:0.5ch solid var(--bCol);filter:drop-shadow( -5px -5px 5px var(--sCol) );}td{padding:2px;}</style>)=====";
//settings menu
const char PAGE_settings0[] PROGMEM = R"=====(
<!DOCTYPE html>
<html><head><title>WLED Settings</title>
)=====";
const char PAGE_settings0[] PROGMEM = R"=====(<!DOCTYPE html>
<html><head><title>WLED Settings</title>)=====";
const char PAGE_settings1[] PROGMEM = R"=====(
body{text-align:center;background:var(--cCol);height:100%;margin:0;background-attachment:fixed}html{--h:11.55vh}button{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),Helvetica,sans-serif;border:.3ch solid var(--bCol);display:inline-block;filter:drop-shadow(-5px -5px 5px var(--sCol));font-size:8vmin;height:var(--h);width:95%;margin-top:2.4vh}</style>
const char PAGE_settings1[] PROGMEM = R"=====(body{text-align:center;background:var(--cCol);height:100%;margin:0;background-attachment:fixed}html{--h:11.55vh}button{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),Helvetica,sans-serif;border:.3ch solid var(--bCol);display:inline-block;filter:drop-shadow(-5px -5px 5px var(--sCol));font-size:8vmin;height:var(--h);width:95%;margin-top:2.4vh}</style>
<script>function BB(){if(window.frameElement){document.getElementById("b").style.display="none";document.documentElement.style.setProperty("--h","13.86vh")}};</script>
</head>
<body onload=BB()>
@ -27,19 +22,15 @@ body{text-align:center;background:var(--cCol);height:100%;margin:0;background-at
<form action=/settings/time><button type=submit>Time & Macros</button></form>
<form action=/settings/sec><button type=submit>Security & Updates</button></form>
</body>
</html>
)=====";
</html>)=====";
//wifi settings
const char PAGE_settings_wifi0[] PROGMEM = R"=====(
<!DOCTYPE html>
const char PAGE_settings_wifi0[] PROGMEM = R"=====(<!DOCTYPE html>
<html><head><meta name="viewport" content="width=500">
<title>WiFi Settings</title><script>function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#wifi-settings");}function B(){window.history.back();}function GetV(){var d = document;
)=====";
<title>WiFi Settings</title><script>function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#wifi-settings");}function B(){window.history.back();}function GetV(){var d = document;)=====";
const char PAGE_settings_wifi1[] PROGMEM = R"=====(
</head>
const char PAGE_settings_wifi1[] PROGMEM = R"=====(</head>
<body onload="GetV()">
<form id="form_s" name="Sf" method="post">
<div class="helpB"><button type="button" onclick="H()">?</button></div>
@ -76,13 +67,11 @@ AP IP: <span class="sip"> Not active </span><hr>
<button type="button" onclick="B()">Back</button><button type="submit">Save & Reboot</button>
</form>
</body>
</html>
)=====";
</html>)=====";
//LED settings
const char PAGE_settings_leds0[] PROGMEM = R"=====(
<!DOCTYPE html>
const char PAGE_settings_leds0[] PROGMEM = R"=====(<!DOCTYPE html>
<html><head><meta name="viewport" content="width=500">
<title>LED Settings</title><script>function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#led-settings");}function B(){window.history.back();}function S(){GetV();UI();}function UI(){
var myC=document.querySelectorAll('.wc'),l=myC.length;
@ -91,11 +80,9 @@ var val=Math.ceil((100+document.Sf.LC.value*55)/500)/2;
val=(val>5)?Math.ceil(val):val;var s="";
if (val<1.1){s="ESP 5V pin with 1A USB supply";}else{s="External 5V ";s+=val;s+="A supply connected to LEDs";}
document.getElementById('psu').innerHTML=s;document.getElementById('ps2').innerHTML=val+"A = "+val*1000;
}function GetV(){var d = document;
)=====";
}function GetV(){var d = document;)=====";
const char PAGE_settings_leds1[] PROGMEM = R"=====(
</head>
const char PAGE_settings_leds1[] PROGMEM = R"=====(</head>
<body onload="S()">
<form id="form_s" name="Sf" method="post">
<div class="helpB"><button type="button" onclick="H()">?</button></div>
@ -164,20 +151,16 @@ Skip first LED: <input type="checkbox" name="SL"><hr>
<button type="button" onclick="B()">Back</button><button type="submit">Save</button>
</form>
</body>
</html>
)=====";
</html>)=====";
//User Interface settings
const char PAGE_settings_ui0[] PROGMEM = R"=====(
<!DOCTYPE html>
const char PAGE_settings_ui0[] PROGMEM = R"=====(<!DOCTYPE html>
<html><head><meta name="viewport" content="width=500">
<title>UI Settings</title><script>
function gId(s){return document.getElementById(s);}function S(){GetV();Ct();}function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#user-interface-settings");}function B(){window.history.back();}function Ct(){if (gId("co").selected){gId("cth").style.display="block";}else{gId("cth").style.display="none";}}function GetV(){var d = document;
)=====";
function gId(s){return document.getElementById(s);}function S(){GetV();Ct();}function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#user-interface-settings");}function B(){window.history.back();}function Ct(){if (gId("co").selected){gId("cth").style.display="block";}else{gId("cth").style.display="none";}}function GetV(){var d = document;)=====";
const char PAGE_settings_ui1[] PROGMEM = R"=====(
</head>
const char PAGE_settings_ui1[] PROGMEM = R"=====(</head>
<body onload="S()">
<form id="form_s" name="Sf" method="post">
<div class="helpB"><button type="button" onclick="H()">?</button></div>
@ -201,7 +184,7 @@ Color Theme:
<option value="4">Electric</option>
<option value="5">Mint</option>
<option value="6">Amber</option>
<option value="7">Club</option>
<option value="7">Dark</option>
<option value="8">Air</option>
<option value="9">Nixie</option>
<option value="10">Terminal</option>
@ -224,19 +207,15 @@ Make sure the font you use is installed on your system!<br>
<hr><button type="button" onclick="B()">Back</button><button type="submit">Save</button>
</form>
</body>
</html>
)=====";
</html>)=====";
//sync settings
const char PAGE_settings_sync0[] PROGMEM = R"=====(
<!DOCTYPE html>
const char PAGE_settings_sync0[] PROGMEM = R"=====(<!DOCTYPE html>
<html><head><meta name="viewport" content="width=500"><title>Sync Settings</title>
<script>function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#sync-settings");}function B(){window.open("/settings","_self");}function GetV(){var d = document;
)=====";
<script>function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#sync-settings");}function B(){window.open("/settings","_self");}function GetV(){var d = document;)=====";
const char PAGE_settings_sync1[] PROGMEM = R"=====(
</head>
const char PAGE_settings_sync1[] PROGMEM = R"=====(</head>
<body onload="GetV()">
<form id="form_s" name="Sf" method="post">
<div class="helpB"><button type="button" onclick="H()">?</button></div>
@ -295,22 +274,18 @@ Hue status: <span class="hms"> Internal ESP Error! </span><hr>
<button type="button" onclick="B()">Back</button><button type="submit">Save</button>
</form>
</body>
</html>
)=====";
</html>)=====";
//time and macro settings
const char PAGE_settings_time0[] PROGMEM = R"=====(
<!DOCTYPE html>
const char PAGE_settings_time0[] PROGMEM = R"=====(<!DOCTYPE html>
<html><head><meta name="viewport" content="width=500"><title>Time Settings</title>
<script>var d=document;function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#time-settings");}function B(){window.open("/settings","_self");}function S(){BTa();GetV();Cs();FC();}function gId(s){return d.getElementById(s);}function Cs(){gId("cac").style.display="none";gId("coc").style.display="block";gId("ccc").style.display="none";if (gId("ca").selected){gId("cac").style.display="block";}if (gId("cc").selected){gId("coc").style.display="none";gId("ccc").style.display="block";}if (gId("cn").selected){gId("coc").style.display="none";}}
function BTa(){var ih="<tr><th>Active</th><th>Hour</th><th>Minute</th><th>Macro</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th><th>S</th></tr>";for (i=0;i<8;i++){ih+="<tr><td><input name=\"W"+i+"\" id=\"W"+i+"\" type=\"number\" style=\"display:none\"><input id=\"W"+i+"0\" type=\"checkbox\"></td><td><input name=\"H"+i+"\" type=\"number\" min=\"0\" max=\"24\"></td><td><input name=\"N"+i+"\" type=\"number\" min=\"0\" max=\"59\"></td><td><input name=\"T"+i+"\" type=\"number\" min=\"0\" max=\"16\"></td>";for (j=1;j<8;j++) ih+="<td><input id=\"W"+i+j+"\" type=\"checkbox\"></td>";}gId("TMT").innerHTML=ih;}
function FC(){for(j=0;j<8;j++){for(i=0;i<8;i++)gId("W"+i+j).checked=gId("W"+i).value>>j&1;}}
function Wd(){a=[0,0,0,0,0,0,0,0];for(i=0;i<8;i++){m=1;for(j=0;j<8;j++){a[i]+=gId("W"+i+j).checked*m;m*=2;}gId("W"+i).value=a[i];}}function GetV(){
)=====";
function Wd(){a=[0,0,0,0,0,0,0,0];for(i=0;i<8;i++){m=1;for(j=0;j<8;j++){a[i]+=gId("W"+i+j).checked*m;m*=2;}gId("W"+i).value=a[i];}}function GetV(){)=====";
const char PAGE_settings_time1[] PROGMEM = R"=====(
</head>
const char PAGE_settings_time1[] PROGMEM = R"=====(</head>
<body onload="S()">
<form id="form_s" name="Sf" method="post" onsubmit="Wd()">
<div class="helpB"><button type="button" onclick="H()">?</button></div>
@ -391,20 +366,16 @@ Time-Controlled Macros:<br>
<button type="button" onclick="B()">Back</button><button type="submit">Save</button>
</form>
</body>
</html>
)=====";
</html>)=====";
//security settings and about
const char PAGE_settings_sec0[] PROGMEM = R"=====(
<!DOCTYPE html>
const char PAGE_settings_sec0[] PROGMEM = R"=====(<!DOCTYPE html>
<html><head><meta name="viewport" content="width=500">
<title>Misc Settings</title>
<script>function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#security-settings");}function B(){window.open("/settings","_self");}function U(){window.open("/update","_self");}function GetV(){var d = document;
)=====";
<script>function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#security-settings");}function B(){window.open("/settings","_self");}function U(){window.open("/update","_self");}function GetV(){var d = document;)=====";
const char PAGE_settings_sec1[] PROGMEM = R"=====(
</head>
const char PAGE_settings_sec1[] PROGMEM = R"=====(</head>
<body onload="GetV()">
<form id="form_s" name="Sf" method="post">
<div class="helpB"><button type="button" onclick="H()">?</button></div>
@ -436,5 +407,4 @@ Server message: <span class="msg"> Response error! </span><hr>
<button type="button" onclick="B()">Back</button><button type="submit">Save & Reboot</button>
</form>
</body>
</html>
)=====";
</html>)=====";

View File

@ -78,7 +78,7 @@
//version code in format yymmddb (b = daily build)
#define VERSION 1902092
#define VERSION 1902101
char versionString[] = "0.8.3-dev";

View File

@ -372,12 +372,12 @@ void getThemeColors(char o[][9])
// accent color (aCol) background (bCol) panel (cCol) controls (dCol) shadows (sCol) text (tCol)
default: strcpy(o[0], "D9B310"); strcpy(o[1], "0B3C5D"); strcpy(o[2], "1D2731"); strcpy(o[3], "328CC1"); strcpy(o[4], "000"); strcpy(o[5], "328CC1"); break; //night
case 1: strcpy(o[0], "eee"); strcpy(o[1], "ddd"); strcpy(o[2], "b9b9b9"); strcpy(o[3], "049"); strcpy(o[4], "777"); strcpy(o[5], "049"); break; //modern
case 2: strcpy(o[0], "abc"); strcpy(o[1], "fff"); strcpy(o[2], "ddd"); strcpy(o[3], "000"); strcpy(o[4], "0004"); strcpy(o[5], "000"); break; //bright
case 2: strcpy(o[0], "abb"); strcpy(o[1], "fff"); strcpy(o[2], "ddd"); strcpy(o[3], "000"); strcpy(o[4], "0004"); strcpy(o[5], "000"); break; //bright
case 3: strcpy(o[0], "c09f80"); strcpy(o[1], "d7cec7"); strcpy(o[2], "76323f"); strcpy(o[3], "888"); strcpy(o[4], "3334"); strcpy(o[5], "888"); break; //wine
case 4: strcpy(o[0], "3cc47c"); strcpy(o[1], "828081"); strcpy(o[2], "d9a803"); strcpy(o[3], "1e392a"); strcpy(o[4], "000a"); strcpy(o[5], "1e392a"); break; //electric
case 5: strcpy(o[0], "57bc90"); strcpy(o[1], "a5a5af"); strcpy(o[2], "015249"); strcpy(o[3], "88c9d4"); strcpy(o[4], "0004"); strcpy(o[5], "88c9d4"); break; //mint
case 6: strcpy(o[0], "f7c331"); strcpy(o[1], "dcc7aa"); strcpy(o[2], "6b7a8f"); strcpy(o[3], "f7882f"); strcpy(o[4], "0007"); strcpy(o[5], "f7882f"); break; //amber
case 7: strcpy(o[0], "fc3"); strcpy(o[1], "124"); strcpy(o[2], "334"); strcpy(o[3], "f1d"); strcpy(o[4], "f00"); strcpy(o[5], "f1d"); break; //club
case 6: strcpy(o[0], "f7c331"); strcpy(o[1], "dca"); strcpy(o[2], "6b7a8f"); strcpy(o[3], "f7882f"); strcpy(o[4], "0007"); strcpy(o[5], "f7882f"); break; //amber
case 7: strcpy(o[0], "fff"); strcpy(o[1], "333"); strcpy(o[2], "222"); strcpy(o[3], "666"); strcpy(o[4], ""); strcpy(o[5], "fff"); break; //dark
case 8: strcpy(o[0], "0ac"); strcpy(o[1], "124"); strcpy(o[2], "224"); strcpy(o[3], "003eff"); strcpy(o[4], "003eff"); strcpy(o[5], "003eff"); break; //air
case 9: strcpy(o[0], "f70"); strcpy(o[1], "421"); strcpy(o[2], "221"); strcpy(o[3], "a50"); strcpy(o[4], "f70"); strcpy(o[5], "f70"); break; //nixie
case 10: strcpy(o[0], "2d2"); strcpy(o[1], "010"); strcpy(o[2], "121"); strcpy(o[3], "060"); strcpy(o[4], "040"); strcpy(o[5], "3f3"); break; //terminal

View File

@ -2,6 +2,8 @@
* MQTT communication protocol for home automation
*/
#define WLED_MQTT_PORT 1883
void parseMQTTBriPayload(char* payload)
{
if (strcmp(payload, "ON") == 0) {bri = briLast; colorUpdated(1);}
@ -111,9 +113,9 @@ bool initMQTT()
IPAddress mqttIP;
if (mqttIP.fromString(mqttServer)) //see if server is IP or domain
{
mqtt->setServer(mqttIP,1883);
mqtt->setServer(mqttIP, WLED_MQTT_PORT);
} else {
mqtt->setServer(mqttServer,1883);
mqtt->setServer(mqttServer, WLED_MQTT_PORT);
}
mqtt->setCallback(callbackMQTT);
DEBUG_PRINTLN("MQTT ready.");

View File

@ -87,6 +87,22 @@ void initServer()
serveMessage(200,"Security settings saved.","Rebooting now... (takes ~20 seconds, wait for auto-redirect)",139);
reset();
});
server.on("/json", HTTP_ANY, [](){
server.send(500, "application/json", "{\"error\":\"Not implemented\"}");
});
server.on("/json/effects", HTTP_GET, [](){
server.setContentLength(strlen_P(JSON_mode_names));
server.send(200, "application/json", "");
server.sendContent_P(JSON_mode_names);
});
server.on("/json/palettes", HTTP_GET, [](){
server.setContentLength(strlen_P(JSON_palette_names));
server.send(200, "application/json", "");
server.sendContent_P(JSON_palette_names);
});
server.on("/version", HTTP_GET, [](){
server.send(200, "text/plain", (String)VERSION);