Release of WLED v0.9.0-b1

Timebase reset when turned off
Added Aurora paletta
This commit is contained in:
cschwinne 2019-12-13 01:23:07 +01:00
parent f1810a9784
commit c98c54bd6b
18 changed files with 1546 additions and 1489 deletions

View File

@ -586,7 +586,8 @@ const char JSON_palette_names[] PROGMEM = R"=====([
"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","Orangery","C9","Sakura"
"Magenta","Magred","Yelmag","Yelblu","Orange & Teal","Tiamat","April Night","Orangery","C9","Sakura",
"Aurora"
])=====";
#endif

View File

@ -481,6 +481,10 @@ void WS2812FX::resetSegments() {
_segments[0].speed = DEFAULT_SPEED;
_segments[0].stop = _length;
_segments[0].setOption(0, 1); //select
for (uint16_t i = 1; i < MAX_NUM_SEGMENTS; i++)
{
_segments[i].colors[0] = color_wheel(i*51);
}
}
void WS2812FX::setIndividual(uint16_t i, uint32_t col)

View File

@ -38,6 +38,7 @@ body {
height: 100%;
width: 100%;
position: fixed;
overscroll-behavior: none;
}
p {
@ -173,9 +174,9 @@ button {
width: 100%;
width: calc(var(--n)*100%);
height: calc(100% - var(--tp, 60px) - var(--bt, 60px));
margin-bottom: 62px;
margin-top: var(--tp, 60px);
transform: translate(calc(var(--tx, 0px) + var(--i, 0)/var(--n)*-100%));
overscroll-behavior: none;
}
.tabcontent {
@ -245,11 +246,8 @@ button {
text-align: center;
border-radius: 2px;
padding: 16px;
padding: 16px;
padding: 16px;
padding: 16px;
position: fixed;
z-index: 1;
z-index: 2;
left: 50%;
transform: translateX(-50%);
bottom: 100px;
@ -766,7 +764,7 @@ input[type=number]::-webkit-outer-spin-button {
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("RangeTouch",t):e.RangeTouch=t()}(this,function(){"use strict";function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var t={addCSS:!0,thumbWidth:15,watch:!0};var n=function(e){return null!=e?e.constructor:null},r=function(e,t){return!!(e&&t&&e instanceof t)},u=function(e){return null==e},i=function(e){return n(e)===Object},o=function(e){return n(e)===String},a=function(e){return Array.isArray(e)},c=function(e){return r(e,NodeList)},l={nullOrUndefined:u,object:i,number:function(e){return n(e)===Number&&!Number.isNaN(e)},string:o,boolean:function(e){return n(e)===Boolean},function:function(e){return n(e)===Function},array:a,nodeList:c,element:function(e){return r(e,Element)},event:function(e){return r(e,Event)},empty:function(e){return u(e)||(o(e)||a(e)||c(e))&&!e.length||i(e)&&!Object.keys(e).length}};function s(e,t){if(1>t){var n=function(e){var t="".concat(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0}(t);return parseFloat(e.toFixed(n))}return Math.round(e/t)*t}return function(){function n(e,r){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,n),l.element(e)?this.element=e:l.string(e)&&(this.element=document.querySelector(e)),l.element(this.element)&&l.empty(this.element.rangeTouch)&&(this.config=Object.assign({},t,r),this.init())}return r=n,i=[{key:"setup",value:function(e){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},u=null;if(l.empty(e)||l.string(e)?u=Array.from(document.querySelectorAll(l.string(e)?e:'input[type="range"]')):l.element(e)?u=[e]:l.nodeList(e)?u=Array.from(e):l.array(e)&&(u=e.filter(l.element)),l.empty(u))return null;var i=Object.assign({},t,r);l.string(e)&&i.watch&&new MutationObserver(function(t){Array.from(t).forEach(function(t){Array.from(t.addedNodes).forEach(function(t){l.element(t)&&function(e,t){return function(){return Array.from(document.querySelectorAll(t)).includes(this)}.call(e,t)}(t,e)&&new n(t,i)})})}).observe(document.body,{childList:!0,subtree:!0});return u.map(function(e){return new n(e,r)})}},{key:"enabled",get:function(){return"ontouchstart"in document.documentElement}}],(u=[{key:"init",value:function(){n.enabled&&(this.config.addCSS&&(this.element.style.userSelect="none",this.element.style.webKitUserSelect="none",this.element.style.touchAction="manipulation"),this.listeners(!0),this.element.rangeTouch=this)}},{key:"destroy",value:function(){n.enabled&&(this.listeners(!1),this.element.rangeTouch=null)}},{key:"listeners",value:function(e){var t=this,n=e?"addEventListener":"removeEventListener";["touchstart","touchmove","touchend"].forEach(function(e){t.element[n](e,function(e){return t.set(e)},!1)})}},{key:"get",value:function(e){if(!n.enabled||!l.event(e))return null;var t,r=e.target,u=e.changedTouches[0],i=parseFloat(r.getAttribute("min"))||0,o=parseFloat(r.getAttribute("max"))||100,a=parseFloat(r.getAttribute("step"))||1,c=r.getBoundingClientRect(),f=100/c.width*(this.config.thumbWidth/2)/100;return 0>(t=100/c.width*(u.clientX-c.left))?t=0:100<t&&(t=100),50>t?t-=(100-2*t)*f:50<t&&(t+=2*(t-50)*f),i+s(t/100*(o-i),a)}},{key:"set",value:function(e){n.enabled&&l.event(e)&&!e.target.disabled&&(e.preventDefault(),e.target.value=this.get(e),function(e,t){if(e&&t){var n=new Event(t);e.dispatchEvent(n)}}(e.target,"touchend"===e.type?"change":"input"))}}])&&e(r.prototype,u),i&&e(r,i),n;var r,u,i}()});
//page js
var ps = false, noNewSegs = false;
var isOn = false, nlA = false, isLv = false, syncSend = false, isRgbw = false;
var isOn = false, nlA = false, isLv = false, syncSend = false, syncTglRecv = true, isRgbw = false;
var whites = [0,0,0];
var expanded = [false];
var nlDur = 60;
@ -835,14 +833,14 @@ function showToast(text, error = false) {
x.style.animation = 'none';
x.offsetHeight;
x.style.animation = null;
timeout = setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
timeout = setTimeout(function(){ x.className = x.className.replace("show", ""); }, 2900);
}
function showErrorToast() {
showToast('Connection to light failed. Please refresh the page. If the issue persists, reboot your ESP.', true);
}
function clearErrorToast() {
d.getElementById("toast").className.replace("error", "");
d.getElementById("toast").className = d.getElementById("toast").className.replace("error", "");
}
function populateSegments(s)
@ -866,8 +864,8 @@ function populateSegments(s)
</label>
<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}">
Start LED: <input class="starts" id="seg${i}s" class="noslide" type="number" min="0" max="${ledCount-1}" value="${inst.start}" oninput="updateLen(this)"><br>
Stop LED: <input class="stops botpad" id="seg${i}e" class="noslide" type="number" min="0" max="${ledCount}" value="${inst.stop}" oninput="updateLen(this)">
Start LED: <input class="starts noslide" id="seg${i}s" type="number" min="0" max="${ledCount-1}" value="${inst.start}" oninput="updateLen(this)"><br>
Stop LED: <input class="stops noslide botpad" id="seg${i}e" type="number" min="0" max="${ledCount}" value="${inst.stop}" oninput="updateLen(this)">
<span class="h">(${inst.stop - inst.start} LED${inst.stop - inst.start > 1 ? "s":""})</span><br>
<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>
@ -951,13 +949,12 @@ function requestJson(command, verbose = true) {
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';
if (command)
{
command.v = verbose;
req = JSON.stringify(command);
console.log(req);
}
fetch
(url, {
@ -977,7 +974,8 @@ function requestJson(command, verbose = true) {
clearTimeout(jsonTimeout);
jsonTimeout = null;
clearErrorToast();
if (json.success) return; //non-verbose response
if (!json) showToast('Empty response', true);
if (json.success) return;
var s = json;
if (!command) {
var x='',y='<option value="0">Default</option>';
@ -999,10 +997,11 @@ function requestJson(command, verbose = true) {
var name = info.name;
d.getElementById('namelabel').innerHTML = name;
if (name === "Dinnerbone") d.documentElement.style.transform = "rotate(180deg)";
if (json.info.live) name = "(Live) " + name;
if (info.live) name = "(Live) " + name;
d.title = name;
isRgbw = info.leds.wv;
ledCount = info.leds.count;
syncTglRecv = info.str;
maxSeg = info.leds.maxseg;
s = json.state;
}
@ -1026,6 +1025,11 @@ function requestJson(command, verbose = true) {
if(s.seg[i].sel) {selc = ind; break;} ind++;
}
var i=s.seg[selc];
if (!i) {
showToast('No Segments!', true);
updateUI();
return;
}
var cd = d.getElementById('csl').children;
for (e = 2; e >= 0; e--)
{
@ -1039,17 +1043,14 @@ function requestJson(command, verbose = true) {
d.getElementById('sliderIntensity').value = i.ix;
d.getElementById('fxb' + selectedFx).style.backgroundColor = "#333";
var f = i.fx;
selectedFx = i.fx;
e2.value = i.pal;
isPaused = i.psd;
if (!command) d.getElementById('Effects').scrollTop = d.getElementById('fxb' + selectedFx).offsetTop - d.getElementById('Effects').clientHeight/1.8;
if (s.error) showToast('WLED error ' + s.error, true);
updateUI();
})
.catch(function (error) {
console.log('Request failed', error);
showToast(error, true);
})
}
@ -1081,7 +1082,8 @@ function toggleSync() {
} else {
showToast('This light and other lights in the network will no longer sync.');
}
var obj = {"udpn": {"send": syncSend, "recv": syncSend}};
var obj = {"udpn": {"send": syncSend}};
if (syncTglRecv) obj.udpn.recv = syncSend;
requestJson(obj);
}
@ -1103,8 +1105,8 @@ function makeSeg() {
Segment ${lowestUnused} (new)
</label>
<div class="segin expanded">
Start LED: <input class="starts" id="seg${lowestUnused}s" class="noslide" type="number" min="0" max="${ledCount-1}" value="${ns}" oninput="updateLen(this)"><br>
Stop LED: <input class="stops" id="seg${lowestUnused}e" class="noslide" type="number" min="0" max="${ledCount}" value="${ledCount}" oninput="updateLen(this)">
Start LED: <input class="starts noslide" id="seg${lowestUnused}s" type="number" min="0" max="${ledCount-1}" value="${ns}" oninput="updateLen(this)"><br>
Stop LED: <input class="stops noslide" id="seg${lowestUnused}e" type="number" min="0" max="${ledCount}" value="${ledCount}" oninput="updateLen(this)">
<span class="h">(${ledCount - ns} LEDs)</span><br>
<i class="icons slider-icon cnf" id="segc${lowestUnused}" onclick="setSeg(${lowestUnused}); resetUtil();">&#xe390;</i>
</div>
@ -1113,7 +1115,8 @@ function makeSeg() {
}
function resetUtil() {
d.getElementById('segutil').innerHTML = '<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" onclick="makeSeg()"><i class="icons btn-icon">&#xe18a;</i>Add segment</button><br>`;
d.getElementById('segutil').innerHTML = cn;
}
function selSeg(s){
@ -1123,15 +1126,18 @@ function selSeg(s){
}
function setSeg(s){
var start = d.getElementById(`seg${s}s`).value;
var stop = d.getElementById(`seg${s}e`).value;
var obj = {"seg": {"id": s, "start": parseInt(start), "stop": parseInt(stop)}};
console.log(obj);
var start = parseInt(d.getElementById(`seg${s}s`).value);
var stop = parseInt(d.getElementById(`seg${s}e`).value);
if (stop <= start) {delSeg(s); return;};
var obj = {"seg": {"id": s, "start": start, "stop": stop}};
requestJson(obj);
}
function delSeg(s){
if (segCount < 2) return;
if (segCount < 2) {
showToast("You need to have multiple segments in order to delete one.");
return;
}
expanded[s] = false;
segCount--;
var obj = {"seg": {"id": s, "stop": 0}};
@ -1140,7 +1146,6 @@ function delSeg(s){
function setRev(s){
var rev = d.getElementById(`seg${s}rev`).checked;
console.log(rev);
var obj = {"seg": {"id": s, "rev": rev}};
requestJson(obj);
}

View File

@ -88,7 +88,7 @@
<button type="button" onclick="U()">Manual OTA Update</button><br>
Enable ArduinoOTA: <input type="checkbox" name="AO"><br>
<h3>About</h3>
<a href="https://github.com/Aircoookie/WLED" target="_blank">WLED</a> version 0.8.4<br><br>
<a href="https://github.com/Aircoookie/WLED" target="_blank">WLED</a> version 0.9.0<br><br>
<a href="https://github.com/Aircoookie/WLED/wiki/Contributors-&-About" target="_blank">Contributors, dependencies and special thanks</a><br>
A huge thank you to everyone who helped me create WLED!<br><br>
(c) 2016-2019 Christian Schwinne <br>

View File

@ -103,6 +103,7 @@
Device Auth token: <input name="BK" maxlength="33"><br>
<i>Clear the token field to disable. </i><a href="https://github.com/Aircoookie/WLED/wiki/Blynk" target="_blank">Setup info</a>
<h3>MQTT</h3>
Enable MQTT: <input type="checkbox" name="MQ"><br>
Broker: <input name="MS" maxlength="32"><br>
Username: <input name="MQTTUSER" maxlength="32"><br>
Password: <input type="password" input name="MQTTPASS" maxlength="32"><br>

View File

@ -98,7 +98,8 @@
<div class="helpB"><button type="button" onclick="H()">?</button></div>
<button type="button" onclick="B()">Back</button><button type="submit">Save</button><hr>
<h2>Web Setup</h2>
Server description: <input name="DS" maxlength="32"><br><br>
Server description: <input name="DS" maxlength="32"><br>
Sync button toggles both send and receive: <input type="checkbox" name="ST"><br><br>
<hr><button type="button" onclick="B()">Back</button><button type="submit">Save</button>
</form>
</body>

View File

@ -167,7 +167,8 @@ function gId(s){return document.getElementById(s);}function S(){GetV();Ct();}fun
<div class="helpB"><button type="button" onclick="H()">?</button></div>
<button type="button" onclick="B()">Back</button><button type="submit">Save</button><hr>
<h2>Web Setup</h2>
Server description: <input name="DS" maxlength="32"><br><br>
Server description: <input name="DS" maxlength="32"><br>
Sync button toggles both send and receive: <input type="checkbox" name="ST"><br><br>
<hr><button type="button" onclick="B()">Back</button><button type="submit">Save</button>
</form>
</body>
@ -218,6 +219,7 @@ For best results, only use one of these services at a time.<br>
Device Auth token: <input name="BK" maxlength="33"><br>
<i>Clear the token field to disable. </i><a href="https://github.com/Aircoookie/WLED/wiki/Blynk" target="_blank">Setup info</a>
<h3>MQTT</h3>
Enable MQTT: <input type="checkbox" name="MQ"><br>
Broker: <input name="MS" maxlength="32">
Port: <input name="MQPORT" type="number" min="1" max="65535" required><br>
<b>The MQTT credentials are sent over an unsecured connection.<br>

File diff suppressed because it is too large Load Diff

View File

@ -564,6 +564,14 @@ DEFINE_GRADIENT_PALETTE( Sakura_gp ) {
130, 223, 45, 72,
195, 255, 82,103,
255, 223, 13, 17};
DEFINE_GRADIENT_PALETTE( Aurora_gp ) {
0, 1, 5, 45, //deep blue
64, 0,200, 23,
128, 0,255, 0, //green
170, 0,243, 45,
200, 0,135, 7,
255, 1, 5, 45};//deep blue
// Single array of defined cpt-city color palettes.
@ -614,6 +622,7 @@ const TProgmemRGBGradientPalettePtr gGradientPalettes[] = {
Orangery_gp, //47-34 Orangery
C9_gp, //48-35 C9
Sakura_gp, //49-36 Sakura
Aurora_gp, //50-37 Aurora
};

View File

@ -98,7 +98,7 @@
//version code in format yymmddb (b = daily build)
#define VERSION 1912111
#define VERSION 1912121
char versionString[] = "0.9.0-b1";
@ -148,7 +148,6 @@ bool fadeTransition = true; //enable crossfading color transit
bool enableSecTransition = true; //also enable transition for secondary color
uint16_t transitionDelay = 750; //default crossfade duration in ms
//bool strip.reverseMode = false; //flip entire LED strip (reverses all effect directions) --> edit in WS2812FX.h
bool skipFirstLed = false; //ignore first LED in strip (useful if you need the LED as signal repeater)
uint8_t disableNLeds = 0; //disables N LEDs between active nodes. (Useful for spacing out lights for more traditional christmas light look)
byte briMultiplier = 100; //% of brightness to set (to limit power, if you set it to 50 and set bri to 255, actual brightness will be 127)
@ -156,6 +155,7 @@ byte briMultiplier = 100; //% of brightness to set (to limit
//User Interface CONFIG
char serverDescription[33] = "WLED"; //Name of module
bool syncToggleReceive = false; //UIs which only have a single button for sync should toggle send+receive if this is true, only send otherwise
//Sync CONFIG
@ -189,6 +189,7 @@ bool arlsForceMaxBri = false; //enable to force max brightness i
uint16_t e131Universe = 1; //settings for E1.31 (sACN) protocol
bool e131Multicast = false;
bool mqttEnabled = false;
char mqttDeviceTopic[33] = ""; //main MQTT topic (individual per device, default is wled/mac)
char mqttGroupTopic[33] = "wled/all"; //second MQTT topic (for example to group devices)
char mqttServer[33] = ""; //both domains and IPs should work (no SSL)

View File

@ -6,7 +6,7 @@
#define EEPSIZE 2560
//eeprom Version code, enables default settings instead of 0 init on update
#define EEPVER 13
#define EEPVER 14
//0 -> old version, default
//1 -> 0.4p 1711272 and up
//2 -> 0.4p 1711302 and up
@ -20,7 +20,8 @@
//10-> 0.8.2
//11-> 0.8.5-dev #mqttauth @TimothyBrown
//12-> 0.8.7-dev
//13-> 0.9.0
//13-> 0.9.0-dev
//14-> 0.9.0-b1
void commit()
{
@ -152,7 +153,7 @@ void saveSettingsToEEPROM()
EEPROM.write(394, abs(utcOffsetSecs) & 0xFF);
EEPROM.write(395, (abs(utcOffsetSecs) >> 8) & 0xFF);
EEPROM.write(396, (utcOffsetSecs<0)); //is negative
//397 was initLedsLast
EEPROM.write(397, syncToggleReceive);
EEPROM.write(398, (ledCount >> 8) & 0xFF);
EEPROM.write(399, !enableSecTransition);
@ -241,6 +242,7 @@ void saveSettingsToEEPROM()
EEPROM.write(2290 + i, timerMacro[i] );
}
EEPROM.write(2299, mqttEnabled);
writeStringToEEPROM(2300, mqttServer, 32);
writeStringToEEPROM(2333, mqttDeviceTopic, 32);
writeStringToEEPROM(2366, mqttGroupTopic, 32);
@ -462,6 +464,14 @@ void loadSettingsFromEEPROM(bool first)
{
readStringFromEEPROM(990, ntpServerName, 32);
}
if (lastEEPROMversion > 13)
{
mqttEnabled = EEPROM.read(2299);
syncToggleReceive = EEPROM.read(397);
} else {
mqttEnabled = true;
syncToggleReceive = false;
}
receiveDirect = !EEPROM.read(2200);
notifyMacro = EEPROM.read(2201);

View File

@ -243,6 +243,7 @@ void getSettingsJS(byte subPage, char* dest)
if (subPage == 3)
{
sappends('s',"DS",serverDescription);
sappend('c',"ST",syncToggleReceive);
}
if (subPage == 4)
@ -271,6 +272,7 @@ void getSettingsJS(byte subPage, char* dest)
sappends('s',"BK",(char*)((blynkEnabled)?"Hidden":""));
#ifdef WLED_ENABLE_MQTT
sappend('c',"MQ",mqttEnabled);
sappends('s',"MS",mqttServer);
sappend('v',"MQPORT",mqttPort);
sappends('s',"MQUSER",mqttUser);

View File

@ -113,6 +113,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
if (subPage == 3)
{
strlcpy(serverDescription, request->arg("DS").c_str(), 33);
syncToggleReceive = request->hasArg("ST");
}
//SYNC
@ -153,6 +154,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
}
#ifdef WLED_ENABLE_MQTT
mqttEnabled = request->hasArg("MQ");
strlcpy(mqttServer, request->arg("MS").c_str(), 33);
t = request->arg("MQPORT").toInt();
if (t > 0) mqttPort = t;

View File

@ -179,7 +179,7 @@ void handleNotifications()
col[0] = udpIn[3];
col[1] = udpIn[4];
col[2] = udpIn[5];
if (udpIn[11] > 0) //check if sending modules white val is inteded
if (udpIn[11] > 0) //sending module's white val is intended
{
col[3] = udpIn[10];
if (udpIn[11] > 1)
@ -192,7 +192,7 @@ void handleNotifications()
if (udpIn[11] > 5)
{
uint32_t t = (udpIn[25] << 24) | (udpIn[26] << 16) | (udpIn[27] << 8) | (udpIn[28]);
t -= 2;
t += 2;
t -= millis();
strip.timebase = t;
}

View File

@ -12,6 +12,13 @@ void setValuesFromMainSeg()
effectPalette = seg.palette;
}
void resetTimebase()
{
strip.timebase = 0 - millis();
}
void toggleOnOff()
{
if (bri == 0)
@ -81,7 +88,7 @@ void colorUpdated(int callMode)
{
//call for notifier -> 0: init 1: direct change 2: button 3: notification 4: nightlight 5: other (No notification)
// 6: fx changed 7: hue 8: preset cycle 9: blynk 10: alexa
if (callMode != 1 && callMode != 5) strip.applyToAllSelected = true; //if not from JSON api, which directly sets segments
if (callMode != 0 && callMode != 1 && callMode != 5) strip.applyToAllSelected = true; //if not from JSON api, which directly sets segments
bool fxChanged = strip.setEffectConfig(effectCurrent, effectSpeed, effectIntensity, effectPalette);
if (!colorChanged())
@ -113,6 +120,7 @@ void colorUpdated(int callMode)
colIT[i] = col[i];
colSecIT[i] = colSec[i];
}
if (briT == 0 && callMode != 3) resetTimebase();
briIT = bri;
if (bri > 0) briLast = bri;

View File

@ -106,7 +106,7 @@ void publishMqtt()
bool initMqtt()
{
lastMqttReconnectAttempt = millis();
if (mqttServer[0] == 0 || !WLED_CONNECTED) return false;
if (!mqttEnabled || mqttServer[0] == 0 || !WLED_CONNECTED) return false;
if (mqtt == nullptr) {
mqtt = new AsyncMqttClient();

View File

@ -68,7 +68,7 @@ void initServer()
server.on("/settings/wifi", HTTP_POST, [](AsyncWebServerRequest *request){
if (!(wifiLock && otaLock)) handleSettingsSet(request, 1);
serveMessage(request, 200,"WiFi settings saved.","Reconnecting now...",129);
serveMessage(request, 200,"WiFi settings saved.","Please connect to the new IP (if changed)",129);
forceReconnect = true;
});
@ -79,7 +79,7 @@ void initServer()
server.on("/settings/ui", HTTP_POST, [](AsyncWebServerRequest *request){
handleSettingsSet(request, 3);
serveMessage(request, 200,"UI settings saved.","Reloading to apply theme...",122);
serveMessage(request, 200,"UI settings saved.","Redirecting...",1);
});
server.on("/settings/sync", HTTP_POST, [](AsyncWebServerRequest *request){
@ -94,7 +94,7 @@ void initServer()
server.on("/settings/sec", HTTP_POST, [](AsyncWebServerRequest *request){
handleSettingsSet(request, 6);
if (!doReboot) serveMessage(request, 200,"Security settings saved.","Rebooting now, please wait ~10 seconds...",129);
if (!doReboot) serveMessage(request, 200,"Security settings saved.","Rebooting, please wait ~10 seconds...",129);
doReboot = true;
});

View File

@ -123,15 +123,23 @@ bool deserializeState(JsonObject root)
if (segVar.is<JsonObject>())
{
int id = segVar["id"] | -1;
if (id < 0) { //set all selected segments
bool didSet = false;
byte lowestActive = 99;
for (byte s = 0; s < strip.getMaxSegments(); s++)
{
WS2812FX::Segment sg = strip.getSegment(s);
if (sg.isActive() && sg.isSelected())
if (sg.isActive())
{
deserializeSegment(segVar, s);
if (lowestActive == 99) lowestActive = s;
if (sg.isSelected()) {
deserializeSegment(segVar, s);
didSet = true;
}
}
}
if (!didSet && lowestActive < strip.getMaxSegments()) deserializeSegment(segVar, lowestActive);
} else { //set only the segment with the specified ID
deserializeSegment(segVar, it);
}
@ -144,7 +152,6 @@ bool deserializeState(JsonObject root)
}
}
//fromJson = true;
colorUpdated(noNotification ? 5:1);
ps = root["psave"] | -1;
@ -239,6 +246,8 @@ void serializeInfo(JsonObject root)
leds["maxpwr"] = strip.ablMilliampsMax;
leds["maxseg"] = strip.getMaxSegments();
leds["seglock"] = false; //will be used in the future to prevent modifications to segment config
root["str"] = syncToggleReceive;
root["name"] = serverDescription;
root["udpport"] = udpPort;
@ -295,7 +304,7 @@ void serializeInfo(JsonObject root)
root["brand"] = "WLED";
root["product"] = "DIY light";
root["btype"] = "dev";
root["btype"] = "bin";
root["mac"] = escapedMac;
}